Hey,
I found an issue related with JobLock Plugin. By default, JobLock re-enqueues a job if its key was already set. If, for some reason, renqueue fails the error will be caught in here:
|
} catch (error) { |
|
this.error = error; |
|
if (!triedAfterPerform) { |
|
try { |
|
await RunPlugins( |
|
this, |
|
"afterPerform", |
|
job.class, |
|
this.queue, |
|
this.jobs[job.class], |
|
job.args |
|
); |
|
} catch (error) { |
|
if (error && !this.error) { |
|
this.error = error; |
|
} |
|
} |
|
} |
|
return this.completeJob(!this.error, startedAt); |
|
} |
and afterPerform stage will be executed anyway. This will cause JobLock key to be deleted and it will completely break the plugin purpose because it immediately allows other jobs(that share the same key) to be executed concurrently.
Possible solutions:
- refactor
Joblock beforePerform() stage to handle any possible errors when re-enqueing
- don't call
RunPlugins('afterPerform') if job perform wasn't effectively called.
Cheers
Hey,
I found an issue related with
JobLockPlugin. By default, JobLock re-enqueues a job if its key was already set. If, for some reason, renqueue fails the error will be caught in here:node-resque/src/core/worker.ts
Lines 295 to 314 in 708ea4a
and
afterPerformstage will be executed anyway. This will causeJobLockkey to be deleted and it will completely break the plugin purpose because it immediately allows other jobs(that share the same key) to be executed concurrently.Possible solutions:
JoblockbeforePerform()stage to handle any possible errors when re-enqueingRunPlugins('afterPerform')if job perform wasn't effectively called.Cheers