2

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.

Jeremy
  • 942
  • 1
  • 10
  • 28

1 Answers1

1

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
Rajarshi Das
  • 11,778
  • 6
  • 46
  • 74