You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
export const consume = async () => {
const worker = new Worker(
"contacts",
async (job: Job) => {
await sleep(200);
throw new Error("foobar");
},
{
connection: redisConnection,
limiter: {
max: 20,
duration: 1000,
},
concurrency: 10,
}
);
worker.on("completed", async (job: Job) => {
console.log("[completed]", job.data.email);
});
const failedJobs: Job[] = [];
worker.on("failed", async (job: Job) => {
console.log("[failed]", job.stacktrace);
failedJobs.push(job);
});
worker.on("drained", async () => {
console.log("[queue drained]");
await worker.close();
// I have to do this because defaultJobOptions.removeOnFail: false, doesn't work, already have opened issue
failedJobs.forEach(async (job) => {
await job.retry("failed");
});
});
};
If I run this multiple times, this is logged
UnhandledPromiseRejectionWarning: Error: Retried job not failed
at Job.retry (/home/mythio/Documents/projects/***/node_modules/bullmq/src/classes/job.ts:437:13)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:2403) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch().
Why is this happening?
The text was updated successfully, but these errors were encountered:
If I run this multiple times, this is logged
Why is this happening?
The text was updated successfully, but these errors were encountered: