From 866a689d4f7db0dcfd29ec6e0031c8b1f26b92a6 Mon Sep 17 00:00:00 2001 From: Samuel Cochran Date: Tue, 14 Nov 2023 21:47:19 -0800 Subject: [PATCH 1/3] Fix when resque failure backend is already multiple --- lib/bugsnag/integrations/resque.rb | 2 +- spec/integrations/resque_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/bugsnag/integrations/resque.rb b/lib/bugsnag/integrations/resque.rb index 8d997f80..6ec4652d 100644 --- a/lib/bugsnag/integrations/resque.rb +++ b/lib/bugsnag/integrations/resque.rb @@ -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 ||= [] diff --git a/spec/integrations/resque_spec.rb b/spec/integrations/resque_spec.rb index 4716b33a..d09e2155 100644 --- a/spec/integrations/resque_spec.rb +++ b/spec/integrations/resque_spec.rb @@ -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) From 17f7d9316c441a28c14488731ffc12ab8c1e4f50 Mon Sep 17 00:00:00 2001 From: Joe Haines Date: Fri, 15 Dec 2023 11:33:46 +0000 Subject: [PATCH 2/3] Add #803 reproduction to rails_integrations app --- .../rails_integrations/app/config/application.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/features/fixtures/rails_integrations/app/config/application.rb b/features/fixtures/rails_integrations/app/config/application.rb index f28492e9..79984d89 100644 --- a/features/fixtures/rails_integrations/app/config/application.rb +++ b/features/fixtures/rails_integrations/app/config/application.rb @@ -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" From 84234e3ba721c08cc4fc2959fe48fe3240cd4948 Mon Sep 17 00:00:00 2001 From: Joe Haines Date: Fri, 15 Dec 2023 12:32:44 +0000 Subject: [PATCH 3/3] Add changelog entry skip-checks: true --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index dfe723de..10a8f40e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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