Skip to content
This repository has been archived by the owner on Mar 18, 2020. It is now read-only.

Commit

Permalink
Reset Rollbar in Resque.before_first_fork
Browse files Browse the repository at this point in the history
Fixes cases where a `Notifier` may have been created prior to the Rollbar initializer calling `Rollbar.configure`. Previously Resque would continue to use this prematurely created `Notifier` and never use the `Configuration` defined by the initializer. See rollbar/rollbar-gem#183
  • Loading branch information
Jonah Williams committed Nov 24, 2014
1 parent 8b74081 commit d5f3091
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/resque/rollbar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
::Rollbar.configure do |config|
config.use_async = false
end
::Rollbar.reset_notifier!
end
19 changes: 19 additions & 0 deletions spec/rollbar_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,24 @@
expect(Rollbar.configuration.use_async).to be_falsey
end
end

context 'when a notifier has been created prior to configuration' do
let!(:unconfigured_notifier) { Rollbar.notifier }

before do
Rollbar.configure do |config|
config.use_resque
end

Resque.before_first_fork.each do |hook|
hook.call
end
end

it 'resets the notifier' do
expect(unconfigured_notifier).to be
expect(Rollbar.notifier).not_to be(unconfigured_notifier)
end
end
end
end

0 comments on commit d5f3091

Please sign in to comment.