Delayed
import { Queue } from 'bullmq';
const myQueue = new Queue('Paint');
// Add a job that will be delayed by at least 5 seconds.
await myQueue.add('house', { color: 'white' }, { delay: 5000 });const targetTime = new Date('03-07-2035 10:30');
const delay = Number(targetTime) - Number(new Date());
await myQueue.add('house', { color: 'white' }, { delay });Change delay
const job = await Job.create(queue, 'test', { foo: 'bar' }, { delay: 2000 });
// Reschedule the job to execute 4000ms (4 seconds) from now
await job.changeDelay(4000);Read more:
Last updated
Was this helpful?