[Backgroundrb-devel] ask_status returning 'running' even when the process has been killed

Ryan Leavengood leavengood at gmail.com
Fri Feb 22 10:16:45 EST 2008

On Fri, Feb 22, 2008 at 9:53 AM, Todd Tyree <todd at snappl.co.uk> wrote:
> The problem I'm having is that ask_status always returns 'Running', even if
> the worker is dead and gone, so I can never get it to restart this way.
> I've confirmed the worker is dead via top, ps and the xmpp admin console.

The master worker keeps the status for workers even after they are
dead, because in most cases it is useful to be able to query a
worker's status once it has died.

This is a little clumsy, but you can write your method like this instead:

def worker_alive?
  !(MiddleMan.all_worker_info.detect{|worker| worker[:status] ==
:running && worker[:worker] == :xmpp_worker }.nil?)

As far as I can see all_worker_info only returns currently running
workers, so probably the check for :status == :running is redundant.


More information about the Backgroundrb-devel mailing list