minor: Deprecate :timeout for :pool_timeout

This commit is contained in:
Kyle Banker 2011-06-15 16:17:42 -04:00
parent b0d5df72fa
commit 3a602e1227
3 changed files with 8 additions and 5 deletions

View File

@ -13,7 +13,7 @@ following release rules:
2. Minor versions (Y in x.Y.z) will be released if new, backward-compatible functionality is introduced to the public API.
3. Major versions (X in X.y.z) will be incremented if any backward-incompatibl changes are introduced to the public API.
3. Major versions (X in X.y.z) will be incremented if any backward-incompatible changes are introduced to the public API.
This policy will clearly indicate to users when an upgrade may affect their code. As a side effect, version numbers will climb more quickly than before.

View File

@ -65,7 +65,7 @@ module Mongo
# logging negatively impacts performance; therefore, it should not be used for high-performance apps.
# @option opts [Integer] :pool_size (1) The maximum number of socket connections allowed per
# connection pool. Note: this setting is relevant only for multi-threaded applications.
# @option opts [Float] :timeout (5.0) When all of the connections a pool are checked out,
# @option opts [Float] :pool_timeout (5.0) When all of the connections a pool are checked out,
# this is the number of seconds to wait for a new connection to be released before throwing an exception.
# Note: this setting is relevant only for multi-threaded applications (which in Ruby are rare).
# @option opts [Float] :op_timeout (nil) The number of seconds to wait for a read operation to time out.
@ -625,7 +625,11 @@ module Mongo
# Pool size and timeout.
@pool_size = opts[:pool_size] || 1
@timeout = opts[:timeout] || 5.0
if opts[:timeout]
warn "The :timeout option has been deprecated " +
"and will be removed in the 2.0 release. Use :pool_timeout instead."
end
@timeout = opts[:pool_timeout] || opts[:timeout] || 5.0
# Timeout on socket read operation.
@op_timeout = opts[:op_timeout] || nil
@ -633,7 +637,6 @@ module Mongo
# Timeout on socket connect.
@connect_timeout = opts[:connect_timeout] || nil
# Mutex for synchronizing pool access
@connection_mutex = Mutex.new

View File

@ -43,7 +43,7 @@ module Mongo
# @option options [Logger, #debug] :logger (nil) Logger instance to receive driver operation log.
# @option options [Integer] :pool_size (1) The maximum number of socket connections allowed per
# connection pool. Note: this setting is relevant only for multi-threaded applications.
# @option options [Float] :timeout (5.0) When all of the connections a pool are checked out,
# @option options [Float] :pool_timeout (5.0) When all of the connections a pool are checked out,
# this is the number of seconds to wait for a new connection to be released before throwing an exception.
# Note: this setting is relevant only for multi-threaded applications.
# @option opts [Float] :op_timeout (nil) The number of seconds to wait for a read operation to time out.