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

In no way job is ever retried #418

Open
Nuffic opened this issue Jun 13, 2021 · 2 comments
Open

In no way job is ever retried #418

Nuffic opened this issue Jun 13, 2021 · 2 comments

Comments

@Nuffic
Copy link

Nuffic commented Jun 13, 2021

Code to reproduce

const Queue = require("bee-queue");
const queue = new Queue("http-sender");

const job = queue.createJob({
  timestamp: Date.now(),
});

job.backoff("exponential", 1000);
job.retries(3);
job.save();

job.on("succeeded", (result) => {
  console.log(`${job.id}: sent`);
});

queue.process((job, done) => {
  console.log(`Processing job ${job.id}`);
  return done(new Error("test"));
});

queue.on("failed", (job, err) => {
  console.log(`Job ${job.id} failed with error ${err.message}`);
});

queue.on("retrying", (job, err) => {
  console.log(
    `Job ${job.id} failed with error ${err.message} but is being retried!`
  );
});
@skeggse
Copy link
Member

skeggse commented Jun 14, 2021

This is evidently not called out in the README, but you need activateDelayedJobs enabled for the retries feature. We can't make the Job#retries function fail if you don't configure that, because in some contexts you may desire to have the job processor entirely separate from the job producer.

@skeggse
Copy link
Member

skeggse commented Jun 14, 2021

Actually, I'll leave this open because we should fix the docs issue.

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

No branches or pull requests

2 participants