Skip to content

Commit 2eb43a5

Browse files
committed
Silence _perform method redefinition warning
I'd like to get rid of this noisy warning: ```shell sentry-rails-5.26.0/lib/sentry/rails/background_worker.rb:5: warning: method redefined; discarding old _perform sentry-ruby-5.26.0/lib/sentry/background_worker.rb:74: warning: previous definition of _perform was here ``` #skip-changelog # Please enter the commit message for your changes. Lines starting # with '#' will be kept; you may remove them yourself if you want to. # An empty message aborts the commit. # # Date: Sun Aug 24 01:04:29 2025 +0400 # # On branch silence-perform-method-redefinition-warning # Changes to be committed: # modified: lib/sentry/rails/background_worker.rb #
1 parent 337a4ca commit 2eb43a5

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

sentry-rails/lib/sentry/rails/background_worker.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
module Sentry
44
class BackgroundWorker
5-
def _perform(&block)
6-
block.call
7-
ensure
8-
# some applications have partial or even no AR connection
9-
if ActiveRecord::Base.connected?
10-
# make sure the background worker returns AR connection if it accidentally acquire one during serialization
11-
ActiveRecord::Base.connection_pool.release_connection
5+
prepend Module.new do
6+
def _perform(&block)
7+
super(&block)
8+
ensure
9+
if ActiveRecord::Base.connected?
10+
ActiveRecord::Base.connection_pool.release_connection
11+
end
1212
end
1313
end
1414
end

0 commit comments

Comments
 (0)