Guest User

Untitled

a guest
Feb 19th, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. diff --git a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
  2. index 838b043..c7f04de 100644
  3. --- a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
  4. +++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
  5. @@ -201,7 +201,7 @@ module ActiveRecord
  6.  
  7. def checkout_and_verify(c)
  8. c.run_callbacks :checkout
  9. - c.verify!(verification_timeout)
  10. + c.verify_now!
  11. @checked_out << c
  12. c
  13. end
  14. diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
  15. index 005be9d..da67662 100755
  16. --- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
  17. +++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
  18. @@ -128,11 +128,15 @@ module ActiveRecord
  19. def verify!(timeout)
  20. now = Time.now.to_i
  21. if (now - @last_verification) > timeout
  22. - reconnect! unless active?
  23. - @last_verification = now
  24. + verify_now! now
  25. end
  26. end
  27.  
  28. + def verify_now!(now = Time.now.to_i)
  29. + reconnect! unless active?
  30. + @last_verification = now
  31. + end
  32. +
  33. # Provides access to the underlying database connection. Useful for
  34. # when you need to call a proprietary method such as postgresql's lo_*
  35. # methods
Add Comment
Please, Sign In to add comment