Prioritized
Last updated
Was this helpful?
Last updated
Was this helpful?
Jobs can also include a priority
option. Using priorities, job processing order will be affected by the specified priority
instead of following a FIFO or LIFO pattern.
Adding prioritized jobs is a slower operation than the other types of jobs, with a complexity O(log(n))
relative to the number of jobs in the prioritized set in the queue.
Note that the priorities go from 1
to 2 097 152
, where a lower number is always a higher priority than higher numbers.
Jobs without a priority
assigned will get the highest priority, being processed before jobs with priorities assigned to them.
If several jobs are added with the same priority value, then the jobs within that priority will be processed in fashion.
If you want to change the priority
after inserting a job, use the changePriority
method. For example, let's say that you want to change the priority
from 16
to 1
:
As prioritized is a new state. You must use getJobs
or getPrioritized
method as:
If you want to get the count
of jobs in prioritized
status (priorities higher than 0) or in waiting
status (priority 0), use the getCountsPerPriority
method. For example, let's say that you want to get counts for priority
1
and 0
:
or if you want to use the option:
📋
💡
💡
💡