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

Job property finishedOn is undefined #863

Closed
ghost opened this issue Nov 8, 2021 · 4 comments · Fixed by #900
Closed

Job property finishedOn is undefined #863

ghost opened this issue Nov 8, 2021 · 4 comments · Fixed by #900

Comments

@ghost
Copy link

ghost commented Nov 8, 2021

When subscribing to the completed event on the worker with worker.on('completed', async (job) => { }), job.finishedOn is undefined.
But when I subscribe to the completed event through QueueEvents, the finishedOn property is set after getting the job with the job id.
Is there any explanation to this behaviour ?

@roggervalf
Copy link
Collaborator

hi @Seldonari, I couldn't reproduce your case, I'm seeing that worker is working as expected, I modify some test cases to check this

@neemanjabu
Copy link

neemanjabu commented Nov 28, 2021

Hi @roggervalf,
this also happens once stalled job state is updated to "failed" after stalled attempts/counts are exhausted.
In this case, the "finishedOn" timestamp is not set.

@roggervalf
Copy link
Collaborator

Thanks @neemanjabu,
now a fix version was released with this change

@fractalawareness
Copy link

fractalawareness commented Jun 1, 2022

I believe this bug still happens the same way but on failed event on the latest version (1.85.0).

worker.on('failed', async (job) => {
	let {id, finishedOn} = job;
	console.log(finishedOn); // undefined
	({finishedOn} = await queue.getJob(id));
	console.log(finishedOn); // timestamp
});

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

Successfully merging a pull request may close this issue.

3 participants