-
Notifications
You must be signed in to change notification settings - Fork 518
Description
Is your feature request related to a problem? Please describe.
Currently, it is possible to call invalid job methods inside the process function of a worker, for example:
const worker = new Worker(
queueName,
async job => {
await job.moveToDelayed();
}, { ... }This call will be performed successfully but later when the job actually completes we will end with strange errors like
Error: Missing lock for job [jobId]... moveToDelayed
Describe the solution you'd like
We should implement safeguards so that the invalid job methods directly throw an exception that will early in development notify the user that the method is invalid and thus it cannot be used inside the process function.
Additional context
For most methods we have special errors that can be thrown from the process function to achieve similar results in a correct way, for example: https://docs.bullmq.io/patterns/process-step-jobs#delaying