Skip to content
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

Priority is illogical #531

Closed
adamreisnz opened this issue May 8, 2021 · 2 comments
Closed

Priority is illogical #531

adamreisnz opened this issue May 8, 2021 · 2 comments

Comments

@adamreisnz
Copy link

From the documentation:

Priorities goes from 1 to MAX_INT, whereas lower number is always higher priority than higher numbers.

Most frameworks or libraries that I've worked with always followed the pattern that a higher priority = higher number, in other words priority: 10 is a higher priority than priority: 2.

BullMQ seems to do it the other way around, which is illogical because now we can use mathematical equivalence to simply generate numbers that are higher than 1 to increase priority of tasks. Instead, we have to start with MAX_INT which is the lowest priority.

This doesn't make much sense to me. Is it possible to make reverse how priorities are compared in a future version of bullmq? Or introduce a setting allowing us to switch the way priority is handled?

It is more logical and easier to reason about if the lower number corresponds to the lower priority, and the higher number to the higher priority.

Thanks,.

@adamreisnz
Copy link
Author

Also, it is not clear from the documentation what the priority is of tasks where the priority is not specified. Is that MAX_INT? Has every job with a priority of < MAX_INT thus a higher priority than jobs without priority specified?

Again, this would be easier to reason about if a not specified priority would equal to priority 0 (e.g. empty, null, zero), and any number higher than that would correspond to a higher priority.

@manast
Copy link
Contributor

manast commented May 8, 2021

I understand you may be used to a different priority arrangement, but there is nothing illogical in arrange it the way it is in BullMQ. In Linux/Unix priorities also go from highest to lowest, starting at priority 0.
You can easily reverse it in user code if that is what you want...

@manast manast closed this as completed May 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants