Created
April 9, 2014 22:03
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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