I'm using version 1.25.2 of Resque in a Rails app.
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
. However the workers still continued to process new jobs added dynamically to any queue. When checked for the state through instance.paused?
every worker returned 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.
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. 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 doesn't allow you to modify the state of a running worker remotely. You must interact with it by signals if you want to change the state of a Resque worker from the outside. If you're just calling the methods, you're not sending a signal.