Method: Mongo::Server::Monitor#stop!

Defined in:
lib/mongo/server/monitor.rb

#stop!true | false

Stop the background thread and wait for it to terminate for a reasonable amount of time.

Returns:

  • (true | false)

    Whether the thread was terminated.

Since:

  • 2.0.0



162
163
164
165
166
167
168
169
170
171
# File 'lib/mongo/server/monitor.rb', line 162

def stop!
  stop_push_monitor!

  # Forward super's return value
  super.tap do
    # Important: disconnect should happen after the background thread
    # terminates.
    connection&.disconnect!
  end
end