Class to poll SRV records on a background thread. Pass a Topology and a TopologySettings. The Topology is weakly referenced.
(self, topology: Topology, topology_settings: TopologySettings)
| 377 | |
| 378 | class SrvMonitor(MonitorBase): |
| 379 | def __init__(self, topology: Topology, topology_settings: TopologySettings): |
| 380 | """Class to poll SRV records on a background thread. |
| 381 | |
| 382 | Pass a Topology and a TopologySettings. |
| 383 | |
| 384 | The Topology is weakly referenced. |
| 385 | """ |
| 386 | super().__init__( |
| 387 | topology, |
| 388 | "pymongo_srv_polling_thread", |
| 389 | common.MIN_SRV_RESCAN_INTERVAL, |
| 390 | topology_settings.heartbeat_frequency, |
| 391 | ) |
| 392 | self._settings = topology_settings |
| 393 | self._seedlist = self._settings._seeds |
| 394 | assert isinstance(self._settings.fqdn, str) |
| 395 | self._fqdn: str = self._settings.fqdn |
| 396 | self._startup_time = time.monotonic() |
| 397 | |
| 398 | async def _run(self) -> None: |
| 399 | # Don't poll right after creation, wait 60 seconds first |