Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QueueScheduler doesn't queue delayed jobs after restarting the scheduler #97

Closed
Flupster opened this issue Dec 23, 2019 · 1 comment
Closed

Comments

@Flupster
Copy link

In my application I have a bunch of jobs that run through the hour and then at the end of the hour we queue the next hour of jobs using the delay option

However when the QueueScheduler restarts it won't process the delay

Here's an example

const { QueueScheduler, Queue, Worker } = require("bullmq");
const scheduler = new QueueScheduler("test");

function QueueJobs() {
  const queue = new Queue("test");

  const arr = new Array(3600);
  const interval = 3600000 / arr.length; // should be 360000/3600 = 1000ms
  arr.forEach((item, i) => {
    const delay = Math.floor((i + 1) * interval); // this should equal 1000, then 2000, then 3000, delaying a job every second
    queue.add("test", { delay }, { delay });
  });
}

(async () => {
  await scheduler.waitUntilReady();
  QueueJobs(); // Jobs run every second as intended
})();


//After we run above code, wait a few seconds and run:

const { QueueScheduler, Queue, Worker } = require("bullmq");
const scheduler = new QueueScheduler("test");

(async () => {
  await scheduler.waitUntilReady();
  //Expected old jobs to continue running every second but they do not.
})();
manast pushed a commit that referenced this issue Mar 8, 2022
@roggervalf
Copy link
Collaborator

as queueScheduler was removed in recent version, we should be ok on closing this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants