Skip to content

Commit

Permalink
depending on job fork configuration use a specific hook
Browse files Browse the repository at this point in the history
this should allow jobs that run inline to still have the app_type set
correctly as before_first_fork is always called regardless of forking
per worker or not. When forking is used for the jobs then the
configuration will only be set in the forked worker
  • Loading branch information
martin308 committed Feb 10, 2017
1 parent ddded00 commit 091704a
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/bugsnag/resque.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,14 @@ def save
# Auto-load the failure backend
Bugsnag::Resque.add_failure_backend

Resque.after_fork do
Bugsnag.configuration.app_type = "resque"
Bugsnag.configuration.default_delivery_method = :synchronous
if Resque::Worker.new.fork_per_job?
Resque.after_fork do
Bugsnag.configuration.app_type = "resque"
Bugsnag.configuration.default_delivery_method = :synchronous
end
else
Resque.before_first_fork do
Bugsnag.configuration.app_type = "resque"
Bugsnag.configuration.default_delivery_method = :synchronous
end
end

0 comments on commit 091704a

Please sign in to comment.