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

Error: Retried job not failed #233

Closed
ghost opened this issue Jun 26, 2020 · 0 comments
Closed

Error: Retried job not failed #233

ghost opened this issue Jun 26, 2020 · 0 comments

Comments

@ghost
Copy link

ghost commented Jun 26, 2020

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?

@ghost ghost closed this as completed Apr 13, 2021
This issue was closed.
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

0 participants