Closed
Description
Is your feature request related to a problem? Please describe.
My CPU intensive jobs would do "correct" work, but they stall with errors:
- Missing lock for job JOB_ID
- Error: job stalled more than allowable limit
async checkStaleCreatives(): Promise<any> {
// Keep busy
const startTime = Date.now();
while (Date.now() - startTime < 30000) {
// Spin
}
}
Describe the solution you'd like
I'd like a way to tell BullMQ that my job is still working correctly. So that my job is not considered stalled.
await job.notifyNotStalled()
or
await queue.notifyNotStalled()
AND/OR the snippet below (or a better fix) should be in the documentation about stalled jobs so people know how to prevent the stalls
- https://docs.bullmq.io/guide/workers/stalled-jobs
- https://docs.bullmq.io/guide/jobs/stalled
- https://docs.bullmq.io/guide/troubleshooting#missing-locks
Describe alternatives you've considered
Adding this in the CPU intensive loop solves my problem
// Yield to the event loop to avoid stalls
await new Promise((resolve) => setTimeout(resolve));