Skip to content

Instantly share code, notes, and snippets.

@MikeSilvis
Created July 5, 2012 16:56
Show Gist options
  • Save MikeSilvis/3054810 to your computer and use it in GitHub Desktop.
Save MikeSilvis/3054810 to your computer and use it in GitHub Desktop.
resque.rake
require 'resque'
if Rails.env.production?
redis_url = ENV["REDISTOGO_URL"]
uri = URI.parse(redis_url)
REDIS = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password)
else
REDIS = Redis.new
end
Resque.redis = REDIS
Resque.after_fork = Proc.new { ActiveRecord::Base.establish_connection }
require 'resque/tasks'
ENV["QUEUE"] = "*"
task "resque:setup" => :environment
task "jobs:work" => "resque:work"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment