Search code examples
rubylinuxruby-on-rails-4delayed-job

Ensure Background Worker is Alive and Working


Is there any way in ruby to determine if a background worker is running?

For instance, i have a server that works a queue in delayed job and i would like to ensure 4 workers are on it and spin up a new worker process if one has either stalled or quit.


Solution

  • From the command line, crontab -lgives a list of all currently running jobs.

    From the Rails console, Delayed::Job.all will give you a list of all currently running jobs.

    Delayed Job also has a list of lifecycle methods which you can access:

    http://www.rubydoc.info/github/collectiveidea/delayed_job/Delayed/Lifecycle