-
Notifications
You must be signed in to change notification settings - Fork 794
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Running Job is not getting disabled #1546
Comments
I have got the same problem... const jobs = await agenda.jobs({
name: jobName,
'data.someID': new mongoose.Types.ObjectId(someID),
});
for (const job of jobs) {
if (pause) {
job.disable();
} else {
job.enable();
}
} I find the correct job, but when i set it to |
cancel the job and then stop the job instance(if the job instance is created for that job only) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Background:
We have 2 types of agenda jobs running
Problem:
agenda.disable({name: "worker-job"})
The job gets updated with the
disabled: true
flag in the agenda collection but this flag gets overridden by the agenda when the Worker Job execution gets completed which makes the Worker job run next time which we don't wantNote: We don't want to stop the current execution of the Worker job we want to control the future run's only
Solutions we thought and rejected
In Monitor job use
agenda.drain()
to drain the agenda queue before disabling the job and once the job is disabled we set the agenda.processEvery() againRejected above approach because of 2 reasons:
agenda.drain()
will lead us to deadlockAny help on disabling the running agenda job will be helpful.
The text was updated successfully, but these errors were encountered: