bull
bull copied to clipboard
global:remove event question.
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?
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
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.
No sure about Nestjs but the removeOnComplete works perfectly fine if you use Bull directly.