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

Method _run

pymongo/periodic_executor.py:233–256  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

231 return False
232
233 def _run(self) -> None:
234 while not self._should_stop():
235 try:
236 if not self._target():
237 self._stopped = True
238 break
239 # Catch KeyboardInterrupt, etc. and cleanup.
240 except BaseException:
241 with self._lock:
242 self._stopped = True
243 self._thread_will_exit = True
244
245 raise
246
247 if self._skip_sleep:
248 self._skip_sleep = False
249 else:
250 deadline = time.monotonic() + self._interval
251 while not self._stopped and time.monotonic() < deadline:
252 time.sleep(self._min_interval)
253 if self._event:
254 break # Early wake.
255
256 self._event = False
257
258
259# _EXECUTORS has a weakref to each running PeriodicExecutor. Once started,

Callers

nothing calls this directly

Calls 2

_should_stopMethod · 0.95
_targetMethod · 0.45

Tested by

no test coverage detected