Local group rate limit
How to rate-limit each group with a different limit per group.
import { QueuePro, WorkerPro } from '@taskforcesh/bullmq-pro';
const queue = new QueuePro('myQueue', { connection });
const groupId = 'my group';
const maxJobsPerDuration = 100;
const duration = 1000; // duration in ms.
await queue.setGroupRateLimit(groupId, maxJobsPerDuration, duration);
const worker = new WorkerPro(
'myQueue',
async () => {
// do something
},
{
group: {
limit: {
// default rate limit configuration
max: 1000,
duration: 1000,
},
},
connection,
},
);Read more:
Last updated
Was this helpful?