lib/mongo/server/connection_pool.rb
# Close sockets that have been open for longer than the max idle time,
#   if the option is set.
#
# @since 2.5.0
Close sockets that have been open for longer than the max idle time,
if the option is set.
Close sockets that have been open for longer than the max idle time if the option is set .
def close_idle_sockets
        return if closed?
        return unless max_idle_time
        @lock.synchronize do
          i = 0
          while i < @available_connections.length
            connection = @available_connections[i]
            if last_checkin = connection.last_checkin
              if (Time.now - last_checkin) > max_idle_time
                connection.disconnect!(reason: :idle)
                @available_connections.delete_at(i)
                @populate_semaphore.signal
                next
              end
            end
            i += 1
          end
        end
      end
def close_idle_sockets return if closed? return unless max_idle_time @lock . synchronize do i = 0 while i < @available_connections . length connection = @available_connections [ i ] if last_checkin = connection . last_checkin if ( Time . now - last_checkin ) > max_idle_time connection . disconnect! ( reason : :idle ) @available_connections . delete_at ( i ) @populate_semaphore . signal next end end i += 1 end end end
Close sockets that have been open for longer than the max idle time,
if the option is set.
Close sockets that have been open for longer than the max idle time if the option is set .
since
None