Sha256: a06176359fe1dd4ed5a9beeba39f9472a1983ce43f44bec92bb864aae2f70afa

Contents?: true

Size: 549 Bytes

Versions: 1

Compression:

Stored size: 549 Bytes

Contents

# frozen_string_literal: true

module PhobosDBCheckpoint
  module Middleware
    class Database
      def initialize(app, options = {})
        @app = app
        PhobosDBCheckpoint.deprecate('options are deprecated, use configuration files instead') if options.keys.any?
        PhobosDBCheckpoint.configure
      end

      def call(request_env)
        ActiveRecord::Base.connection_pool.with_connection do
          @app.call(request_env)
        end
      ensure
        ActiveRecord::Base.clear_active_connections!
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
phobos_db_checkpoint-3.4.0 lib/phobos_db_checkpoint/middleware/database.rb