Skip to content

Instantly share code, notes, and snippets.

@tommeier
Created February 28, 2012 02:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tommeier/1928769 to your computer and use it in GitHub Desktop.
Save tommeier/1928769 to your computer and use it in GitHub Desktop.
Resque initializer
# Why use RAILS_ROOT and RAILS_ENV? Because this way we can tell our Sinatra app about the config file:
# $ RAILS_ENV=production resque-web rails_root/config/initializers/resque.rb
require 'resque'
rails_root = ENV['RAILS_ROOT'] || File.dirname(__FILE__) + '/../..'
rails_env = ENV['RAILS_ENV'] || 'development'
resque_config = YAML.load_file(rails_root + '/config/resque.yml')
Resque.redis = resque_config[rails_env]
#Fire any resque errors to our airbrake configuration
require 'resque/failure/airbrake'
require 'resque/failure/multiple'
require 'resque/failure/redis'
Resque::Failure::Multiple.classes = [Resque::Failure::Redis, Resque::Failure::Airbrake]
Resque::Failure.backend = Resque::Failure::Multiple
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment