OptimalBits / bull

Premium Queue package for handling distributed jobs and messages in NodeJS.
Other
15.31k stars 1.43k forks source link

Priority doesn't seem to be taking effect #2733

Closed admangan closed 1 week ago

admangan commented 2 months ago

I am curious whether anyone else has used the new implementation of priority (1 being highest on down) successfully. I use bull to run tasks made up of small sub jobs, some tasks need to be run first. Despite setting up priority properly (I see it in the job options) the queue continues processing in a FIFO manner.

Am I missing something in the set up? Do I need to adjust queue set up ( I am running this in a nest js app).

Any help is appreciated.

manast commented 2 months ago

Yes, we have tests that cover all the priority functionality: https://github.com/OptimalBits/bull/blob/develop/test/test_queue.js#L1041 It is difficult to know why it does not work for you as you are not providing a test case for us to reproduce.

If you are new to Bull you should use BullMQ instead: https://github.com/taskforcesh/bullmq

admangan commented 2 months ago

Thanks for the reply, we have set up our system on bull but am looking at migrating over to bullmq. Is it as compatible with the nest.js architecture?

The test you shared, started processing the jobs after all have been added. My use case is adding large numbers of jobs at different times (can only run ~50 / minute) and having the higher (lower number) priority jump ahead in the queue even though they have been added later.

I will make a test case to demonstrate this. If it affects, I am using elasticache as my redis cluster.

stale[bot] commented 2 weeks ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.