Skip to content

Commit

Permalink
Merge pull request #803 from sj26/fix-resque-failure-backend-multiple
Browse files Browse the repository at this point in the history
Fix when resque failure backend is already multiple
  • Loading branch information
imjoehaines authored Dec 15, 2023
2 parents bf61828 + 84234e3 commit a219d78
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Changelog
=========

## TBD

### Fixes

* Fix Resque integration when failure backend is already `Resque::Failure::Multiple`
| [#803](https://github.com/bugsnag/bugsnag-ruby/pull/803)
| [sj26](https://github.com/sj26)

## v6.26.0 (19 July 2023)

### Enhancements
Expand Down
11 changes: 11 additions & 0 deletions features/fixtures/rails_integrations/app/config/application.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# reproduce #803 by setting Resque's backend to 'Multiple' before our Resque
# integration runs
# see https://github.com/bugsnag/bugsnag-ruby/pull/803
require "resque"
require "resque/failure/redis"
require "resque/failure/multiple"

Resque::Failure::Multiple.classes = [Resque::Failure::Redis]
Resque::Failure.backend = Resque::Failure::Multiple
# end #803 reproduction

require_relative 'boot'

require "rails"
Expand Down
2 changes: 1 addition & 1 deletion lib/bugsnag/integrations/resque.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def self.add_failure_backend
return if ::Resque::Failure.backend == self

# Ensure resque is using a "Multiple" failure backend
unless ::Resque::Failure.backend < ::Resque::Failure::Multiple
unless ::Resque::Failure.backend <= ::Resque::Failure::Multiple
original_backend = ::Resque::Failure.backend
::Resque::Failure.backend = ::Resque::Failure::Multiple
::Resque::Failure.backend.classes ||= []
Expand Down
2 changes: 1 addition & 1 deletion spec/integrations/resque_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def require(path)
#Auto-load failure backend
backend = double('backend')
allow(::Resque::Failure).to receive(:backend).and_return(backend)
expect(backend).to receive(:<).and_return(nil)
expect(backend).to receive(:<=).and_return(nil)
expect(::Resque::Failure).to receive(:backend=).with(::Resque::Failure::Multiple)
classes = double('classes')
allow(backend).to receive(:classes).and_return(classes)
Expand Down

0 comments on commit a219d78

Please sign in to comment.