Reduce the reuse of job IDs
The current behaviour with job IDs causes some problems. Now, when a new job is launched to the queue, it gets the minimum free ID. The consequence is: this ID is one of the most recently used IDs. This can cause some confusion in custom programs that automatize queue management, but it enables a bug in the dependency system, that you can reproduce with the following steps:
1. Launch a task A to the queue, that gets id 1
2. Launch a second task B to the queue, that gets id 2
3. Delete task A before it even starts
4. Task B will not start, as expected
5. Launch a third task C to the queue, that gets id 1 again
6. Now you will see that when C finishes, task B starts because of the ID reuse.
My suggestion, to fix the bug (or make it very unlikely) and also help third-party programs relying on ids, is to have a "last id" counter that increases with each new job, and only starts again from the beginning when it overflows.
#1 Updated by Jorge Daza Garcia-Blanes almost 7 years ago
- Status changed from New to Feedback
- Priority changed from High to Low
It will be taken into account, but I don't see such a hurry as to set the priority to high ! :)
BTW what you use as id is just the position in the memory array. If you want a full featured id on your jobs... set the name properly and don't expect a counter to do the job for you ;)