lib/sentry/rails/background_worker.rb in sentry-rails-5.3.0 vs lib/sentry/rails/background_worker.rb in sentry-rails-5.3.1
- old
+ new
@@ -1,15 +1,10 @@
module Sentry
class BackgroundWorker
def _perform(&block)
- # some applications have partial or even no AR connection
- if ActiveRecord::Base.connected?
- # make sure the background worker returns AR connection if it accidentally acquire one during serialization
- ActiveRecord::Base.connection_pool.with_connection do
- block.call
- end
- else
- block.call
- end
+ block.call
+ ensure
+ # make sure the background worker returns AR connection if it accidentally acquire one during serialization
+ ActiveRecord::Base.connection_pool.release_connection
end
end
end