MCPcopy Create free account
hub / github.com/mongodb/mongo-python-driver / _run

Method _run

pymongo/synchronous/monitor.py:478–489  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

476 self._moving_min.reset()
477
478 def _run(self) -> None:
479 try:
480 # NOTE: This thread is only run when using the streaming
481 # heartbeat protocol (MongoDB 4.4+).
482 # XXX: Skip check if the server is unknown?
483 rtt = self._ping()
484 self.add_sample(rtt)
485 except ReferenceError:
486 # Topology was garbage-collected.
487 self.close()
488 except Exception:
489 self._pool.reset()
490
491 def _ping(self) -> float:
492 """Run a "hello" command and return the RTT."""

Callers

nothing calls this directly

Calls 4

_pingMethod · 0.95
add_sampleMethod · 0.95
closeMethod · 0.95
resetMethod · 0.45

Tested by

no test coverage detected