minor: fix prune interval

This commit is contained in:
Kyle Banker 2011-11-16 12:19:45 -05:00
parent 5bb0084a13
commit fe58da0e3c

View File

@ -50,7 +50,7 @@ module Mongo
# Operations to perform on a socket # Operations to perform on a socket
@socket_ops = Hash.new { |h, k| h[k] = [] } @socket_ops = Hash.new { |h, k| h[k] = [] }
@sockets_low = false @sockets_low = true
@sockets = [] @sockets = []
@pids = {} @pids = {}
@checked_out = [] @checked_out = []
@ -263,15 +263,17 @@ module Mongo
end end
@connection_mutex.synchronize do @connection_mutex.synchronize do
if @size > 10 && @sockets.size > 0.7 * @size if @size > 10
@sockets_low = true if @sockets.size > 0.7 * @size
else @sockets_low = true
@sockets_low = false else
end @sockets_low = false
end
if (Time.now - @last_pruning) > PRUNE_INTERVAL if (Time.now - @last_pruning) > PRUNE_INTERVAL
prune prune
@last_pruning = Time.now @last_pruning = Time.now
end
end end
socket = if @checked_out.size < @sockets.size socket = if @checked_out.size < @sockets.size