Sha256: a0657627bdd07c3752faac45d302567ef8ae500f0958711f34987a4f1e313203

Contents?: true

Size: 436 Bytes

Versions: 1

Compression:

Stored size: 436 Bytes

Contents

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
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sentry-rails-5.3.0 lib/sentry/rails/background_worker.rb