-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Canceling of job doesn't work #1127
Comments
For BullMQ, there is an open issue to allow cancellation of running jobs: taskforcesh/bullmq#632 I will check into the DefaultJobQueuePlugin. |
Ok, so on further investigation there is no easy way to cancel a running job, since the So one possible way to "cancel" a process: async job => {
let progress = 0;
while (progress < 100) {
if (job.state === JobState.CANCELLED) {
// manually abort if job is cancelled
return;
}
await new Promise(resolve => setTimeout(resolve, job.data.intervalMs));
progress += 10;
job.setProgress(progress);
}
Logger.info(`Completed job ${job.id}`);
return 'Done!';
}, The problem is that to make all jobs cancellable, we would have to add such logic into all existing jobs, which in many cases would require quite a bit of refactoring. |
Hmmm, yeah, no easy way. Is there problem in default job plugin? |
In the default plugin, the job will appear as CANCELLED, but if the |
Relates to #1127, relates to #2650. This commit adds a mechanism to track cancellation of jobs in Redis using pub/sub on a custom set which tracks the IDs which have been cancelled. The job process functions will still continue to execute unless there is specific logic to check the job state and throw an error on cancellation.
Describe the bug
After starting reindexing i cancel job. But i can see job is still processed.
Video https://vendure-ecommerce.slack.com/archives/CKYMF0ZTJ/p1632919005096600
It was on redis job queue. But probably bug also exists in default job plugin.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Job is successfully canceled.
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: