Created
September 4, 2008 08:43
-
-
Save nicksieger/8739 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 838b043..c7f04de 100644 | |
--- a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb | |
+++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb | |
@@ -201,7 +201,7 @@ module ActiveRecord | |
def checkout_and_verify(c) | |
c.run_callbacks :checkout | |
- c.verify!(verification_timeout) | |
+ c.verify_now! | |
@checked_out << c | |
c | |
end | |
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb | |
index 005be9d..da67662 100755 | |
--- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb | |
+++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb | |
@@ -128,11 +128,15 @@ module ActiveRecord | |
def verify!(timeout) | |
now = Time.now.to_i | |
if (now - @last_verification) > timeout | |
- reconnect! unless active? | |
- @last_verification = now | |
+ verify_now! now | |
end | |
end | |
+ def verify_now!(now = Time.now.to_i) | |
+ reconnect! unless active? | |
+ @last_verification = now | |
+ end | |
+ | |
# Provides access to the underlying database connection. Useful for | |
# when you need to call a proprietary method such as postgresql's lo_* | |
# methods |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment