I'm migrating from Delayed_jobs to Resque and given that I'm going to have a lot of jobs always queued (some in the future), it's impossible to know when I can scale workers down to 0 to do a safe new release.
Is there any way to safely tell workers on Heroku to finish processing the current job but not take any new one?
That way , I can scale workers down to zero to do a safe release of a new version on Heroku when jobs are not processing anything.
Then I can scale back up number of workers and resume processing.
Resque workers respond to a few different signals:
QUIT - Wait for child to finish processing then exit
TERM / INT - Immediately kill child then exit
USR1 - Immediately kill child but don't exit
**USR2 - Don't start to process any new jobs**
CONT - Start to process new jobs again after a USR2
In your case you want to not process new jobs so you can use USR2
More read on the signal in heroku
http://hone.herokuapp.com/resque/2012/08/21/resque-signals.html
You need to know the process id and send the signal
USR2 rscue.pid
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.