-
Notifications
You must be signed in to change notification settings - Fork 867
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
job remove event not triggered #942
Comments
Any update on this? Is this project still getting maintained? |
job#remove event is triggered on the producer side, not on the worker side! |
Is there a way to check whether the job has been removed from the workers side? |
Job will be out of worker's hand, when you call |
I'm trying to kill the spawned encoding job through the web UI so you can cancel the encoding job when its running. |
you'd better use gracefulShutdown for this purpose |
I've had a look at the gracefulShutdown and it's not what I'm looking for. It's not the queue that I wish to shutdown its the encoding task. So when you close out a queue job then it would stop the encoding process for that job. So when the job is removed through the web UI I want to kill the spawned encoding task that belongs to the job. |
why you don't simply call |
So something like this? Check out the comments. worker const kue = require('kue');
const queue = kue.createQueue();
const spawn = require('child_process').spawn;
queue.process('transcode', 2, function(job, done) {
const task = spawn(...);
// kill encoding task on error (triggered when removed through the producer)
job.on('error', function(error) {
task.kill('SIGINT');
});
}); producer const kue = require('kue');
const queue = kue.createQueue();
const job = queue.create('encoding', {
title: 'encoding file...',
source: 'video.mkv',
});
job.on('remove', function() {
// call done
job.done(new Error('task aborted'));
}); |
No! var currentJob, doneContext;
queue.process('transcode', 2, function(job, done) {
currentJob = job;
doneContext = done;
});
app.on('myTaskKillEvent', function(){
if( currentJob && doneContext) {
doneContext(new Error('task aborted'));
}
}); |
Aah right but I'm trying to have this work with the web UI. So you can somehow abort the encoding task through the web UI. Do you know of a nice way that I can abort the encoding task through the web UI? |
I'm trying to kill the child_process associated with the job when the job gets removed from the UI but the remove event isn't getting triggered.
This is what I'm trying to get to work:
But the remove event isn't getting triggered.
The text was updated successfully, but these errors were encountered: