Remove Connection#reset_connection (private) and deprecate
ReplSetConnection#reset_connection (public)
This commit is contained in:
parent
a6cc09e50c
commit
3509926071
|
@ -475,7 +475,7 @@ module Mongo
|
|||
#
|
||||
# @raise [ConnectionFailure] if unable to connect to any host or port.
|
||||
def connect
|
||||
reset_connection
|
||||
close
|
||||
|
||||
config = check_is_master(@host_to_try)
|
||||
if config
|
||||
|
@ -536,6 +536,7 @@ module Mongo
|
|||
def close
|
||||
@primary_pool.close if @primary_pool
|
||||
@primary_pool = nil
|
||||
@primary = nil
|
||||
end
|
||||
|
||||
# Returns the maximum BSON object size as returned by the core server.
|
||||
|
@ -668,7 +669,6 @@ module Mongo
|
|||
# TODO: evaluate whether this method is actually necessary
|
||||
def reset_connection
|
||||
close
|
||||
@primary = nil
|
||||
end
|
||||
|
||||
def check_is_master(node)
|
||||
|
|
|
@ -101,7 +101,7 @@ module Mongo
|
|||
#
|
||||
# @raise [ConnectionFailure] if unable to connect to any host or port.
|
||||
def connect
|
||||
reset_connection
|
||||
close
|
||||
@nodes_to_try = @nodes.clone
|
||||
|
||||
while connecting?
|
||||
|
@ -165,13 +165,6 @@ module Mongo
|
|||
@secondary_pools.each do |pool|
|
||||
pool.close
|
||||
end
|
||||
end
|
||||
|
||||
# If a ConnectionFailure is raised, this method will be called
|
||||
# to close the connection and reset connection values.
|
||||
# TODO: what's the point of this method?
|
||||
def reset_connection
|
||||
super
|
||||
@secondaries = []
|
||||
@secondary_pools = []
|
||||
@arbiters = []
|
||||
|
@ -179,6 +172,15 @@ module Mongo
|
|||
@nodes_to_try = []
|
||||
end
|
||||
|
||||
# If a ConnectionFailure is raised, this method will be called
|
||||
# to close the connection and reset connection values.
|
||||
# @deprecated
|
||||
def reset_connection
|
||||
close
|
||||
warn "ReplSetConnection#reset_connection is now deprecated. " +
|
||||
"Use ReplSetConnection#close instead."
|
||||
end
|
||||
|
||||
# Is it okay to connect to a slave?
|
||||
#
|
||||
# @return [Boolean]
|
||||
|
|
Loading…
Reference in New Issue