grantcarthew / node-rethinkdb-job-queue

A persistent job or task queue backed by RethinkDB.
https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki
MIT License
156 stars 16 forks source link

How to halt currently running job in Jobqueue ? #80

Closed gkumar9 closed 6 years ago

gkumar9 commented 6 years ago

I am using jobqueue for running some logic in backend. On certain event, I add entry to Jobqueue and job starts running (inside backend) and job status becomes 'Active'. Now what I need is, on another event from frontend, I need to stop this currently running job in jobqueue. I am using "CancelJob" method, but it only changes status to "Cancel", not halting currently running job from Jobqueue.

grantcarthew commented 6 years ago

Read through the Queue.process document page. You want to be using the onCancel parameter in the process handler.

gkumar9 commented 6 years ago

Thanks, @grantcarthew onCancel worked and helped me abort my currently running process.

grantcarthew commented 6 years ago

Good stuff. Happy to help.