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

global:remove event question. #2176

Open
mmedvedik opened this issue Oct 11, 2021 · 3 comments
Open

global:remove event question. #2176

mmedvedik opened this issue Oct 11, 2021 · 3 comments

Comments

@mmedvedik
Copy link

Imagine I have a host service and worker.
Host creates the job, worker receives it, does it, and marks it as completed, then host remove this job using job.remove(). Here I try to catch remove event ('global:removed') on the worker side, to do some post-job actions, but I do not receive it. Am I correctly understood that only removed locally jobs emit 'removed' event to its own? In other words, is event 'global:removed' work or not?

@manast
Copy link
Member

manast commented Oct 14, 2021

Actually the "removed" global event is missing from the implementation of job.remove, so I will mark this feature as an enhancement. However, I wonder why you need to remove the job manually instead of just setting the "removeOnComplete" option when adding the job? https://github.com/OptimalBits/bull/blob/develop/REFERENCE.md#queueadd

@jbw
Copy link

jbw commented Jun 30, 2022

I came across this too using nestjs. Their documentation has OnGlobalQueueRemoved but it never triggers on a job removal. I'm using this to cancel jobs and hook into that event to set some state.

@manast
Copy link
Member

manast commented Jul 1, 2022

No sure about Nestjs but the removeOnComplete works perfectly fine if you use Bull directly.

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

3 participants