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