Skip to content

Instantly share code, notes, and snippets.

@moret
Created April 9, 2014 22:03
Show Gist options
  • Select an option

  • Save moret/10322938 to your computer and use it in GitHub Desktop.

Select an option

Save moret/10322938 to your computer and use it in GitHub Desktop.
Example using NewRelic with after_fork for Unicorn but always doing so even for Resque workers
require 'rubygems'
require 'bundler/setup'
class SomeJob
@queue = :some_queue
def self.perform
puts 'working - actually, sleeping...'
sleep 1
puts 'done'
end
end
Bundler.require :default
NewRelic::Agent.after_fork(:force_reconnect => true) if defined?(Unicorn) && defined?(NewRelic)
require 'resque/tasks'
task :default do
Resque.enqueue SomeJob
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment