-
Notifications
You must be signed in to change notification settings - Fork 867
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enforce enqueue timestamp instead of job ids for sorting same-priority jobs #678
Comments
Really need this to be fixed... willing to write a PR. Any pointers where to start? |
Since Kue provides a priority based queue, jobs are inserted scored by their priority. One implementation can be using the same scoring logic (priority) but inserting a composed id which contains both (timestamp + job.id), I'm not sure if it is a correct logic... but was the fastest thing came to my mind. |
I'm not using priorities at the moment, all I care about is FIFO logic. Could I just set priority = -timestamp in my code? |
you can patch Kue that way, yes. But you see why I can't approve that to be merged in. |
@behrad thanks. I decided to switch to RabbitMQ in the end. |
I've ran into the same problem and fixed it in a fork. Would you be willing to accept a PR on this? It's an easy fix that basically adds the length of the id in front of it (1 => 11, 12 => 212, 123 => 3123 and so on) |
this is nice and easy fix, there existed also alike PR with Zero padding job.ids which I prefer, since you should also have the logic of splitting We should not use job ids for any FIFO ordering logic, this will also free Kue let the user to specify their own UUIDs for jobs. This should happen for Kue 1.0 |
That would mean a fixed length on the id's though, and that length should also be pretty high so you wont run out of zero's. About the splitting, i'm not. There would be no meaning to do so except making id sequences look 'pretty', which I personally dont care about. |
#708 |
0.10.3 |
jobs are inserted in inactive ZSET by job.id, since http://redis.io/commands/zadd#elements-with-the-same-score, this leads to some mis-behavior in FIFO based job ordering.
The text was updated successfully, but these errors were encountered: