From 3a602e1227a8445cce35b28b0a9d17f6179388a8 Mon Sep 17 00:00:00 2001 From: Kyle Banker Date: Wed, 15 Jun 2011 16:17:42 -0400 Subject: [PATCH] minor: Deprecate :timeout for :pool_timeout --- docs/RELEASES.md | 2 +- lib/mongo/connection.rb | 9 ++++++--- lib/mongo/repl_set_connection.rb | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/docs/RELEASES.md b/docs/RELEASES.md index 9c2b6cf..71453fa 100644 --- a/docs/RELEASES.md +++ b/docs/RELEASES.md @@ -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. diff --git a/lib/mongo/connection.rb b/lib/mongo/connection.rb index c76670b..6eeab0c 100644 --- a/lib/mongo/connection.rb +++ b/lib/mongo/connection.rb @@ -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 diff --git a/lib/mongo/repl_set_connection.rb b/lib/mongo/repl_set_connection.rb index 4f7d7fd..581768e 100644 --- a/lib/mongo/repl_set_connection.rb +++ b/lib/mongo/repl_set_connection.rb @@ -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.