0

is there a built-in way in bullMQ to schedule a job to execute at a specific timestamp in the future?

I know it can somehow be done with:

const targetTime = new Date('03-07-2035 10:30');
const delay = Number(targetTime) - Number(new Date());

await myQueue.add('house', { color: 'white' }, { delay });

but why it needs to calculate the relative time with:

const delay = Number(targetTime) - Number(new Date());

instead of taking a timestamp / unix timestamp directly?

If I add a job to the queue and then I want to schedule it, should I define the worker everytime to make it run?

yeln
  • 462
  • 2
  • 10
  • 23

0 Answers0