quirkey/resque-status

Possible to capture kill?

Closed this issue · 2 comments

Killing the job using resque-status works by killing the resque processes, but I need a way to trap whatever signal is sent so gracefully close down some processing that the job is done. There is (was) a discussion going on about something similar here https://github.com/defunkt/resque/pull/505 but I imagine that the use of resque-status would complicate things a bit, as each job is wrapped.

Are there any thoughts on this already that I haven't come across? Thanks

A Resque::Plugins::Status::Killed Exception will be raised when a job is killed, which you can rescue. Not sure if that helps in your situation, but it works for me.

kill in resque-status is actually completely seperate from the resque process itself. It just raises a Killed error and finishes the job. It also invoked an on_killed callback if you need to do extra processing.