SocketReaper — Documentation by YARD 0.9.37 (original) (raw)

Class: Mongo::Cluster::SocketReaperPrivate

Inherits:

Object

Defined in:

lib/mongo/cluster/reapers/socket_reaper.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

A manager that calls a method on each of a cluster’s pools to close idle

sockets.

Instance Method Summarycollapse

Constructor Details

#initialize(cluster) ⇒ SocketReaper

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initialize the SocketReaper object.

39 40 41 # File 'lib/mongo/cluster/reapers/socket_reaper.rb', line 39 def initialize(cluster) @cluster = cluster end

Instance Method Details

#execute ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Execute the operation to close the pool’s idle sockets.

| 49 50 51 52 53 54 | # File 'lib/mongo/cluster/reapers/socket_reaper.rb', line 49 def execute @cluster.servers.each do |server| server.pool_internal&.close_idle_sockets end true end | | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

#flush ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

When the socket reaper is garbage-collected, there’s no need to close

idle sockets; sockets will be closed anyway when the pools are
garbage collected.
61 62 # File 'lib/mongo/cluster/reapers/socket_reaper.rb', line 61 def flush end