Sha256: 59a1fe28fb400e46ad2ad4622c4fa5bd145d8e08d554fe89b468bc1b431d6667

Contents?: true

Size: 667 Bytes

Versions: 71

Compression:

Stored size: 667 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. Airbrake 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]

    NewRelic::Agent.after_fork(:force_reconnect => true) if defined?(NewRelic)
  end
end

Version data entries

71 entries across 71 versions & 1 rubygems

Version Path
rubber-2.9.0 templates/resque/lib/tasks/resque.rake
rubber-2.8.1 templates/resque/lib/tasks/resque.rake
rubber-2.8.0 templates/resque/lib/tasks/resque.rake
rubber-2.7.5 templates/resque/lib/tasks/resque.rake
rubber-2.7.4 templates/resque/lib/tasks/resque.rake
rubber-2.7.3 templates/resque/lib/tasks/resque.rake
rubber-2.7.2 templates/resque/lib/tasks/resque.rake
rubber-2.7.1 templates/resque/lib/tasks/resque.rake
rubber-2.7.0 templates/resque/lib/tasks/resque.rake
rubber-2.6.5 templates/resque/lib/tasks/resque.rake
rubber-2.6.4 templates/resque/lib/tasks/resque.rake
rubber-2.6.3 templates/resque/lib/tasks/resque.rake
rubber-2.6.2 templates/resque/lib/tasks/resque.rake
rubber-2.6.1 templates/resque/lib/tasks/resque.rake
rubber-2.6.0 templates/resque/lib/tasks/resque.rake
rubber-2.5.5 templates/resque/lib/tasks/resque.rake
rubber-2.5.4 templates/resque/lib/tasks/resque.rake
rubber-2.5.3 templates/resque/lib/tasks/resque.rake
rubber-2.5.2 templates/resque/lib/tasks/resque.rake
rubber-2.5.1 templates/resque/lib/tasks/resque.rake