简体   繁体   English

如何在Heroku上暂停Resque处理?

[英]How to pause Resque processing on Heroku?

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. 我正在从Delayed_jobs迁移到Resque,并且鉴于我将总是有很多工作排队(将来还会有一些工作),所以我不知道何时可以将工作人员缩减到0以进行安全的新发布。

Is there any way to safely tell workers on Heroku to finish processing the current job but not take any new one? 有什么方法可以安全地告诉Heroku上的工人完成当前工作,但不接受任何新工作吗?

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. 这样,当作业不执行任何操作时,我可以将工作人员的人数减少到零,以在Heroku上安全发布新版本。

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 在您的情况下,您不希望处理新作业,因此可以使用USR2

More read on the signal in heroku 阅读有关Heroku中信号的更多信息

http://hone.herokuapp.com/resque/2012/08/21/resque-signals.html http://hone.herokuapp.com/resque/2012/08/21/resque-signals.html

You need to know the process id and send the signal 您需要知道进程ID并发送信号

USR2 rscue.pid

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM