minor: test tweaks for windows
This commit is contained in:
parent
7bebcd0499
commit
1b189336a6
|
@ -297,15 +297,15 @@ module Mongo
|
||||||
def checkin(socket)
|
def checkin(socket)
|
||||||
@connection_mutex.synchronize do
|
@connection_mutex.synchronize do
|
||||||
@checked_out.delete(socket)
|
@checked_out.delete(socket)
|
||||||
end
|
|
||||||
@queue.signal
|
@queue.signal
|
||||||
|
end
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
# Adds a new socket to the pool and checks it out.
|
# Adds a new socket to the pool and checks it out.
|
||||||
#
|
#
|
||||||
# This method is called exclusively from #obtain_socket;
|
# This method is called exclusively from #checkout;
|
||||||
# therefore, it runs within a mutex, as it must.
|
# therefore, it runs within a mutex.
|
||||||
def checkout_new_socket
|
def checkout_new_socket
|
||||||
begin
|
begin
|
||||||
socket = TCPSocket.new(@host, @port)
|
socket = TCPSocket.new(@host, @port)
|
||||||
|
@ -320,8 +320,8 @@ module Mongo
|
||||||
|
|
||||||
# Checks out the first available socket from the pool.
|
# Checks out the first available socket from the pool.
|
||||||
#
|
#
|
||||||
# This method is called exclusively from #obtain_socket;
|
# This method is called exclusively from #checkout;
|
||||||
# therefore, it runs within a mutex, as it must.
|
# therefore, it runs within a mutex.
|
||||||
def checkout_existing_socket
|
def checkout_existing_socket
|
||||||
socket = (@sockets - @checked_out).first
|
socket = (@sockets - @checked_out).first
|
||||||
@checked_out << socket
|
@checked_out << socket
|
||||||
|
|
|
@ -4,7 +4,7 @@ class TestThreading < Test::Unit::TestCase
|
||||||
|
|
||||||
include Mongo
|
include Mongo
|
||||||
|
|
||||||
@@db = Connection.new('localhost', 27017, :pool_size => 1, :timeout => 5).db('ruby-mongo-test')
|
@@db = Connection.new('localhost', 27017, :pool_size => 1, :timeout => 30).db('ruby-mongo-test')
|
||||||
@@coll = @@db.collection('thread-test-collection')
|
@@coll = @@db.collection('thread-test-collection')
|
||||||
|
|
||||||
def set_up_safe_data
|
def set_up_safe_data
|
||||||
|
|
Loading…
Reference in New Issue