Closed gitChristian closed 2 years ago
One solution im thinking of is this:
await refreshQueue.add( id, { data },
{ repeat: { every: minutes * 60 * (800 + <random number 1-400>, } } //800 represents milliseconds
);
This will create some staggering, but is there something better?
This is the wrong repo for BullMQ issues, but I can give you an answer, you can use cron expressions to do this so that you generate the expression in such a way that it is based on the moment the job was added, then you can accomplish staggering.
(repost from bullmq issues) I'm wondering if there is a way to remove the "on the hour" behavior of the Repeatable Job specified here.
Use case: I have a queue with jobs that should run every 6 hours. Throughout that time window, many jobs will be added to the queue. Because of this "on the hour" behavior, all the jobs will try to be run at the same time. Is there any way to have them staggered? Thanks!