aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
index 50b2badbe6..1d7efc89e1 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
@@ -232,10 +232,10 @@ module ActiveRecord
def checkout
# Checkout an available connection
conn = @connection_mutex.synchronize do
- if @connections.length < @size
- checkout_new_connection
- elsif @checked_out.size < @connections.size
+ if @checked_out.size < @connections.size
checkout_existing_connection
+ elsif @connections.size < @size
+ checkout_new_connection
end
end
return conn if conn