Search code examples
ruby-on-railscapistranoresquerails-activejob

How to make sure resque background jobs are always up?


I use ActiveJob with a resque back-end and use capistrano-resque to (re)start my work processes on deploy.

What I have been strugling with is making sure those processes are always up. Can and could such a process crash? Should I put safeguards in making sure that my background jobs always get picked up by a worker?

I have searched far and wide but have not found any standard solution to this.


Solution

  • I am using god with resque. Here's an example script for it.

    Capistrano

    desc "Restart resque workers"
    task :restart_workers, roles: :resque do
      run "sudo god restart resque-production"
    end
    
    after 'deploy:restart', 'deploy:restart_workers'
    

    where resque-production is the w.name from the script example.