Capistrano helper tasks for Resque (requeue & remove failed jobs)
Pull request Compare This branch is even with forward3d:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



ResqueUtils is a gem that gives you extra helper cap commands for use with Resque.


  • Capistrano
  • Resque


Firstly you'll need to install the gem, if you are using bundler add this to your Gemfile (but make sure it doesn't go in a gem group that isn't being sent to the server)...

gem 'resque_utils'

Open your deploy.rb and simple require the file...

require 'resque_utils/capistrano'

You'll then have the following commands available to you...

cap resque:failed:remove_all       # Remove all failed jobs
cap resque:failed:remove_specific  # Remove specific failed jobs (specify with '--set exception=SomeError')
cap resque:failed:remove_retried   # Remove all retried jobs
cap resque:failed:requeue_all      # Requeue all failed jobs
cap resque:failed:requeue_specific # Requeue specific failed jobs (specify with '--set exception=SomeError')

Obviously you won't want this to run on all your nodes, so make sure to filter to the node you want when you run it... cap resque:failed:remove_all

To run the specific commands, for example to requeue any job that failed with the exception SomeError...

cap resque:failed:requeue_specific --set exception=SomeError

You could also do something like this, although i'd really not recommend it...

before 'deploy:symlink', 'resque:failed:remove_all'