diff options
author | Jonathan Rochkind <jonathan@dnil.net> | 2012-09-21 12:35:11 -0400 |
---|---|---|
committer | Jonathan Rochkind <jonathan@dnil.net> | 2012-09-24 16:20:22 -0400 |
commit | 39087068c2e3c85f6839ea51eab4480673138a2b (patch) | |
tree | f9b8a6120ff14d04115e6d31fa17d69035d9a9f1 /activerecord/lib/active_record | |
parent | 7b545ff911a3f9bd3c9b179a2c6ac6b70bab3ee0 (diff) | |
download | rails-39087068c2e3c85f6839ea51eab4480673138a2b.tar.gz rails-39087068c2e3c85f6839ea51eab4480673138a2b.tar.bz2 rails-39087068c2e3c85f6839ea51eab4480673138a2b.zip |
ConnectionPool accepts spec key 'checkout_timeout'
Backport of #6441 cb6f83935 . Old 'wait_timeout' is still supported,
but conflicts with mysql2 using that spec key for different thing.
'checkout_timeout' can now be used taking precedence for ConnectionPool
over 'wait_timeout'.
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb | 12 |
1 files changed, 9 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 d4649102df..ef176a1959 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb @@ -54,8 +54,11 @@ module ActiveRecord # your database connection configuration: # # * +pool+: number indicating size of connection pool (default 5) - # * +wait_timeout+: number of seconds to block and wait for a connection - # before giving up and raising a timeout error (default 5 seconds). + # * +checkout _timeout+: number of seconds to block and wait for a + # connection before giving up and raising a timeout error + # (default 5 seconds). ('wait_timeout' supported for backwards + # compatibility, but conflicts with key used for different purpose + # by mysql2 adapter). class ConnectionPool include MonitorMixin @@ -77,7 +80,10 @@ module ActiveRecord @reserved_connections = {} @queue = new_cond - @timeout = spec.config[:wait_timeout] || 5 + # 'wait_timeout', the backward-compatible key, conflicts with spec key + # used by mysql2 for something entirely different, checkout_timeout + # preferred to avoid conflict and allow independent values. + @timeout = spec.config[:checkout_timeout] || spec.config[:wait_timeout] || 5 # default max pool size to 5 @size = (spec.config[:pool] && spec.config[:pool].to_i) || 5 |