Sha256: 1a8682fba5922b9bff79ec972857f86c33534857397889cb651ea7665f239a9e

Contents?: true

Size: 586 Bytes

Versions: 4

Compression:

Stored size: 586 Bytes

Contents

require 'resque/pool/tasks'

# this task will get called before resque:pool:setup
# and preload the rails environment in the pool manager
task "resque:setup" => :environment do
  # generic worker setup, e.g. Hoptoad for failed jobs
end

task "resque:pool:setup" do
  # close any sockets or files in pool manager
  ActiveRecord::Base.connection.disconnect!
  
  # and re-open them in the resque worker parent
  Resque::Pool.after_prefork do |job|
    ActiveRecord::Base.establish_connection
    Resque.redis = YAML.load_file(Rails.root.join('config', 'resque.yml'))[Rails.env]
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubber-2.0.0.pre4 templates/resque/lib/tasks/resque.rake
rubber-2.0.0.pre3 templates/resque/lib/tasks/resque.rake
rubber-2.0.0.pre2 templates/resque/lib/tasks/resque.rake
rubber-2.0.0.pre1 templates/resque/lib/tasks/resque.rake