Prioritized intra-groups
BullMQ Pro supports priorities per group. A job is prioritized in a group when group and priority options are provided together.
typescript
await myQueue.add(
'paint',
{ foo: 'bar' },
{
group: {
id: 'groupId',
priority: 10,
},
},
);INFO
The priorities go from 0 to 2097151, where a higher number means lower priority (as in Unix processes). Thus, jobs without any explicit priority will have the highest priority.
Get Counts per Priority for Group
If you want to get the count of jobs in prioritized status (priorities higher than 0) or in waiting status (priority 0) for specific group, use the getCountsPerPriorityForGroup method. For example, let's say that you want to get counts for priority 1 and 0:
typescript
const counts = await queue.getCountsPerPriorityForGroup('groupId', [1, 0]);
/*
{
'1': 11,
'0': 10
}
*/