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.
|
# @raise [ConnectionFailure] if unable to connect to any host or port.
|
||||||
def connect
|
def connect
|
||||||
reset_connection
|
close
|
||||||
|
|
||||||
config = check_is_master(@host_to_try)
|
config = check_is_master(@host_to_try)
|
||||||
if config
|
if config
|
||||||
|
@ -536,6 +536,7 @@ module Mongo
|
||||||
def close
|
def close
|
||||||
@primary_pool.close if @primary_pool
|
@primary_pool.close if @primary_pool
|
||||||
@primary_pool = nil
|
@primary_pool = nil
|
||||||
|
@primary = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns the maximum BSON object size as returned by the core server.
|
# 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
|
# TODO: evaluate whether this method is actually necessary
|
||||||
def reset_connection
|
def reset_connection
|
||||||
close
|
close
|
||||||
@primary = nil
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_is_master(node)
|
def check_is_master(node)
|
||||||
|
|
|
@ -101,7 +101,7 @@ module Mongo
|
||||||
#
|
#
|
||||||
# @raise [ConnectionFailure] if unable to connect to any host or port.
|
# @raise [ConnectionFailure] if unable to connect to any host or port.
|
||||||
def connect
|
def connect
|
||||||
reset_connection
|
close
|
||||||
@nodes_to_try = @nodes.clone
|
@nodes_to_try = @nodes.clone
|
||||||
|
|
||||||
while connecting?
|
while connecting?
|
||||||
|
@ -165,13 +165,6 @@ module Mongo
|
||||||
@secondary_pools.each do |pool|
|
@secondary_pools.each do |pool|
|
||||||
pool.close
|
pool.close
|
||||||
end
|
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 = []
|
@secondaries = []
|
||||||
@secondary_pools = []
|
@secondary_pools = []
|
||||||
@arbiters = []
|
@arbiters = []
|
||||||
|
@ -179,6 +172,15 @@ module Mongo
|
||||||
@nodes_to_try = []
|
@nodes_to_try = []
|
||||||
end
|
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?
|
# Is it okay to connect to a slave?
|
||||||
#
|
#
|
||||||
# @return [Boolean]
|
# @return [Boolean]
|
||||||
|
|
Loading…
Reference in New Issue