Module: Sentry::BackgroundWorker::ActiveRecordConnectionPatch

Included in:
Sentry::BackgroundWorker
Defined in:
lib/sentry/rails/background_worker.rb

Instance Method Summary collapse

Instance Method Details

#_perform(&block) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/sentry/rails/background_worker.rb', line 6

def _perform(&block)
  super(&block)
ensure
  # 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.release_connection
  end
end