bull icon indicating copy to clipboard operation
bull copied to clipboard

global:remove event question.

Open mmedvedik opened this issue 3 years ago • 3 comments

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?

mmedvedik avatar Oct 11 '21 12:10 mmedvedik

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

manast avatar Oct 14 '21 03:10 manast

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.

jbw avatar Jun 30 '22 11:06 jbw

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

manast avatar Jul 01 '22 01:07 manast