Module: Gitlab::Patch::ActiveRecordConnectionPool

Defined in:
lib/gitlab/patch/active_record_connection_pool.rb

Overview

rubocop:disable Cop/AvoidReturnFromBlocks – This patches an upstream class rubocop:disable Cop/LineBreakAfterGuardClauses – This patches an upstream class rubocop:disable Cop/LineBreakAroundConditionalBlock – This patches an upstream class rubocop:disable Gitlab/ModuleWithInstanceVariables – This patches an upstream class rubocop:disable Layout/EmptyLineAfterGuardClause – This patches an upstream class rubocop:disable Lint/RescueException – This patches an upstream class rubocop:disable Style/IfUnlessModifier – This patches an upstream class

Instance Method Summary collapse

Instance Method Details

#disconnect_without_verify(raise_on_acquisition_timeout = true) ⇒ Object

Disconnects all connections in the pool, and clears the pool.

Raises:

  • ActiveRecord::ExclusiveConnectionTimeoutError if unable to gain ownership of all connections in the pool within a timeout interval (default duration is spec.db_config.checkout_timeout * 2 seconds).



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/gitlab/patch/active_record_connection_pool.rb', line 33

def disconnect_without_verify(raise_on_acquisition_timeout = true)
  with_exclusively_acquired_all_connections_no_verify(raise_on_acquisition_timeout) do
    synchronize do
      @connections.each do |conn|
        if conn.in_use?
          conn.steal!
          checkin conn
        end
        conn.disconnect!
      end
      @connections = []
      @available.clear
    end
  end
end

#disconnect_without_verify!Object



49
50
51
# File 'lib/gitlab/patch/active_record_connection_pool.rb', line 49

def disconnect_without_verify!
  disconnect_without_verify(false)
end