Sha256: 1acf531eda8092c54cce0b1495d9fd6f6801fd611c0897bc197da6536f71e768

Contents?: true

Size: 534 Bytes

Versions: 3

Compression:

Stored size: 534 Bytes

Contents

module FreshConnection
  module Rack
    class ConnectionManagement
      def initialize(app)
        @app = app
      end

      def call(env)
        @app.call(env)
      ensure
        unless env.key?("rack.test")
          if FreshConnection::SlaveConnection.master_clear_connection?
            ActiveRecord::Base.clear_all_connections!
          else
            ActiveRecord::Base.clear_active_connections!
          end
          FreshConnection::SlaveConnection.clear_all_connections!
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fresh_connection-0.1.1 lib/fresh_connection/rack/connection_management.rb
fresh_connection-0.1.0 lib/fresh_connection/rack/connection_management.rb
fresh_connection-0.0.7 lib/fresh_connection/rack/connection_management.rb