minor: text fixes
This commit is contained in:
parent
9cb9f5c663
commit
fbdf16bd48
|
@ -317,6 +317,11 @@ module Mongo
|
||||||
self.connections[self.object_id] = {}
|
self.connections[self.object_id] = {}
|
||||||
end
|
end
|
||||||
socket = self.connections[self.object_id][:reader] ||= checkout_reader
|
socket = self.connections[self.object_id][:reader] ||= checkout_reader
|
||||||
|
if self.read_pool != @sockets_to_pools[socket]
|
||||||
|
checkin(socket)
|
||||||
|
socket = self.connections[self.object_id][:reader] = checkout_reader
|
||||||
|
end
|
||||||
|
|
||||||
@threads_to_sockets[Thread.current][:reader] = socket
|
@threads_to_sockets[Thread.current][:reader] = socket
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -328,6 +333,10 @@ module Mongo
|
||||||
self.connections[self.object_id] = {}
|
self.connections[self.object_id] = {}
|
||||||
end
|
end
|
||||||
socket = self.connections[self.object_id][:writer] ||= checkout_writer
|
socket = self.connections[self.object_id][:writer] ||= checkout_writer
|
||||||
|
if self.primary_pool != @sockets_to_pools[socket]
|
||||||
|
checkin(socket)
|
||||||
|
socket = self.connections[self.object_id][:writer] = checkout_writer
|
||||||
|
end
|
||||||
@threads_to_sockets[Thread.current][:writer] = socket
|
@threads_to_sockets[Thread.current][:writer] = socket
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -60,12 +60,12 @@ module Mongo
|
||||||
end
|
end
|
||||||
|
|
||||||
def close
|
def close
|
||||||
if @socket
|
if @socket && !@socket.closed?
|
||||||
@socket.close
|
@socket.close
|
||||||
|
end
|
||||||
@socket = nil
|
@socket = nil
|
||||||
@config = nil
|
@config = nil
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def connected?
|
def connected?
|
||||||
@socket != nil
|
@socket != nil
|
||||||
|
|
|
@ -257,7 +257,9 @@ module Mongo
|
||||||
def get_valid_seed_node
|
def get_valid_seed_node
|
||||||
@seeds.each do |seed|
|
@seeds.each do |seed|
|
||||||
node = Mongo::Node.new(self.connection, seed)
|
node = Mongo::Node.new(self.connection, seed)
|
||||||
if node.connect && node.set_config
|
if !node.connect
|
||||||
|
next
|
||||||
|
elsif node.set_config
|
||||||
return node
|
return node
|
||||||
else
|
else
|
||||||
node.close
|
node.close
|
||||||
|
|
|
@ -87,7 +87,6 @@ class ReplicaSetRefreshTest < Test::Unit::TestCase
|
||||||
@conn = ReplSetConnection.new([self.rs.host, self.rs.ports[0]], [self.rs.host, self.rs.ports[1]],
|
@conn = ReplSetConnection.new([self.rs.host, self.rs.ports[0]], [self.rs.host, self.rs.ports[1]],
|
||||||
[self.rs.host, self.rs.ports[2]], :refresh_interval => 2, :refresh_mode => :async)
|
[self.rs.host, self.rs.ports[2]], :refresh_interval => 2, :refresh_mode => :async)
|
||||||
|
|
||||||
@conn.secondary_pools
|
|
||||||
assert_equal 2, @conn.secondary_pools.length
|
assert_equal 2, @conn.secondary_pools.length
|
||||||
assert_equal 2, @conn.secondaries.length
|
assert_equal 2, @conn.secondaries.length
|
||||||
|
|
||||||
|
|
|
@ -93,8 +93,14 @@ class Test::Unit::TestCase
|
||||||
begin
|
begin
|
||||||
yield
|
yield
|
||||||
rescue => e
|
rescue => e
|
||||||
assert_equal klass, e.class
|
if klass.to_s != e.class.to_s
|
||||||
assert e.message.include?(message), "#{e.message} does not include #{message}."
|
flunk "Expected exception class #{klass} but got #{e.class}.\n #{e.backtrace}"
|
||||||
|
end
|
||||||
|
|
||||||
|
if !e.message.include?(message)
|
||||||
|
p e.backtrace
|
||||||
|
flunk "#{e.message} does not include #{message}.\n#{e.backtrace}"
|
||||||
|
end
|
||||||
else
|
else
|
||||||
flunk "Expected assertion #{klass} but none was raised."
|
flunk "Expected assertion #{klass} but none was raised."
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue