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-3.2.2 templates/resque/lib/tasks/resque.rake
rubber-3.2.1 templates/resque/lib/tasks/resque.rake
rubber-3.2.0 templates/resque/lib/tasks/resque.rake
rubber-3.1.0 templates/resque/lib/tasks/resque.rake
rubber-3.0.1 templates/resque/lib/tasks/resque.rake
rubber-3.0.0 templates/resque/lib/tasks/resque.rake
rubber-2.16.0 templates/resque/lib/tasks/resque.rake
rubber-2.15.2 templates/resque/lib/tasks/resque.rake
rubber-2.15.1 templates/resque/lib/tasks/resque.rake
rubber-2.15.0 templates/resque/lib/tasks/resque.rake
rubber-2.14.0 templates/resque/lib/tasks/resque.rake
rubber-2.13.1 templates/resque/lib/tasks/resque.rake
rubber-2.13.0 templates/resque/lib/tasks/resque.rake
rubber-2.12.2 templates/resque/lib/tasks/resque.rake
rubber-2.12.1 templates/resque/lib/tasks/resque.rake
rubber-2.12.0 templates/resque/lib/tasks/resque.rake
rubber-2.11.0 templates/resque/lib/tasks/resque.rake
rubber-2.10.2 templates/resque/lib/tasks/resque.rake
rubber-2.10.1 templates/resque/lib/tasks/resque.rake
rubber-2.10.0 templates/resque/lib/tasks/resque.rake