[英]Resque worker not responding to signals
I'm using version 1.25.2 of Resque in a Rails app. 我在Rails应用程序中使用Resque的1.25.2版本。
I tried to invoke the instance methods pause_processing
and its reverse unpause_processing
of Resque::Worker
class on all the workers I fetched through Resque.workers
. 我试图调用实例方法pause_processing
和其反向unpause_processing
的Resque::Worker
类的所有我通过获取的工人Resque.workers
。 However the workers still continued to process new jobs added dynamically to any queue. 但是,工作人员仍然继续处理动态添加到任何队列中的新作业。 When checked for the state through instance.paused?
通过instance.paused?
检查状态时instance.paused?
every worker returned true
. 每个工人都返回true
。
Not sure if I can really control the workers running in background. 不知道我是否真的可以控制后台运行的工人。
As far as I can comprehend pause_processing
, unpause_processing
and shutdown
do the same thing as sending USR2
CONT
and KILL
signals to Resque workers. 据我pause_processing
, pause_processing
, unpause_processing
和shutdown
与向Resque worker发送USR2
CONT
和KILL
信号的作用相同。
Am I missing something trivial or is there another way to manage the workers. 我是否缺少一些琐碎的事情,或者还有另一种方式来管理工人。
This is because you're calling this method and modifying state on an entirely different instance of the worker. 这是因为您正在调用此方法并在完全不同的worker实例上修改状态。 As you can see all it does is set the value of an instance variable. 如您所见,它所做的就是设置实例变量的值。 When you call Resque.workers
, you get instances of all the workers—but not the instance of the running worker in a different process. 当您调用Resque.workers
,您将获得所有工作程序的实例,但不会获得其他进程中正在运行的工作程序的实例。 Resque doesn't allow you to modify the state of a running worker remotely. Resque不允许您远程修改正在运行的工作程序的状态。 You must interact with it by signals if you want to change the state of a Resque worker from the outside. 如果要从外部更改Resque worker的状态,则必须通过信号与之交互。 If you're just calling the methods, you're not sending a signal. 如果您只是调用方法,则不会发送信号。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.