aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-11-29 13:56:24 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2011-11-29 14:02:59 -0800
commitce3d8d646a7a4077907b1ec2bad5101840d989e5 (patch)
treee754ca2cbee53e2ead8135adf101838a65e3a63a /activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
parent5725e397fe7ea34c7479863278d7db6f18e7658e (diff)
downloadrails-ce3d8d646a7a4077907b1ec2bad5101840d989e5.tar.gz
rails-ce3d8d646a7a4077907b1ec2bad5101840d989e5.tar.bz2
rails-ce3d8d646a7a4077907b1ec2bad5101840d989e5.zip
Start implementing @reserved_connections in terms of connection leases.
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb')
-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 0b3971a0a6..04465db61d 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
@@ -97,7 +97,7 @@ module ActiveRecord
# Check to see if there is an active connection in this connection
# pool.
def active_connection?
- @reserved_connections.key? current_connection_id
+ active_connections.any?
end
# Signal that the thread is finished with the current connection.
@@ -113,7 +113,7 @@ module ActiveRecord
# connection when finished.
def with_connection
connection_id = current_connection_id
- fresh_connection = true unless @reserved_connections[connection_id]
+ fresh_connection = true unless active_connection?
yield connection
ensure
release_connection(connection_id) if fresh_connection
@@ -121,7 +121,7 @@ module ActiveRecord
# Returns true if a connection has already been opened.
def connected?
- !@connections.empty?
+ @connections.any?
end
# Disconnects all connections in the pool, and clears the pool.