taskforcesh / bullmq

BullMQ - Message Queue and Batch processing for NodeJS and Python based on Redis
https://bullmq.io
MIT License
5.47k stars 357 forks source link

Include more information in `WorkerListener.stalled` event #2548

Closed JonathanSun closed 1 month ago

JonathanSun commented 1 month ago

Is your feature request related to a problem? Please describe. When listening to the stalled event on a worker, only the jobId is included as context: https://api.docs.bullmq.io/interfaces/v5.WorkerListener.html#stalled

For some scenarios this is an insufficient amount of information to properly debug the issue. For example:

Describe the solution you'd like The stalled event should include the detailed job information just like other events like failed: https://api.docs.bullmq.io/interfaces/v5.WorkerListener.html#failed

Of course, the job may not always be available if it is removed, but this can just return undefined (like the failed event does).

Describe alternatives you've considered Otherwise, you have to manually implement a way to look up the right job information from the API when the stalled event fires.

Additional context N/A

manast commented 1 month ago
  • If a worker listens to multiple queues, the jobId may not be unique.

How is this possible? I mean, a given worker can only listen to one queue's stalled event? The reason we do not pass the jobs is to keep the data bandwidth as small as possible. As most users won't need the complete job data, it is wasteful to send it in every event. If you need the data then you should get the job from Redis using Queue.getJob https://api.docs.bullmq.io/classes/v5.Queue.html#getJob