MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / _get_seedlist

Method _get_seedlist

pymongo/asynchronous/monitor.py:411–436  ·  view source on GitHub ↗

Poll SRV records for a seedlist. Returns a list of ServerDescriptions.

(self)

Source from the content-addressed store, hash-verified

409 await self.close()
410
411 async def _get_seedlist(self) -> Optional[list[tuple[str, Any]]]:
412 """Poll SRV records for a seedlist.
413
414 Returns a list of ServerDescriptions.
415 """
416 try:
417 resolver = _SrvResolver(
418 self._fqdn,
419 self._settings.pool_options.connect_timeout,
420 self._settings.srv_service_name,
421 )
422 seedlist, ttl = await resolver.get_hosts_and_min_ttl()
423 if len(seedlist) == 0:
424 # As per the spec: this should be treated as a failure.
425 raise Exception
426 except Exception as exc:
427 # As per the spec, upon encountering an error:
428 # - An error must not be raised
429 # - SRV records must be rescanned every heartbeatFrequencyMS
430 # - Topology must be left unchanged
431 self.request_check()
432 _debug_log(_SDAM_LOGGER, message="SRV monitor check failed", failure=repr(exc))
433 return None
434 else:
435 self._executor.update_interval(max(ttl, common.MIN_SRV_RESCAN_INTERVAL))
436 return seedlist
437
438
439class _RttMonitor(MonitorBase):

Callers 1

_runMethod · 0.95

Calls 5

_SrvResolverClass · 0.90
_debug_logFunction · 0.90
get_hosts_and_min_ttlMethod · 0.45
request_checkMethod · 0.45
update_intervalMethod · 0.45

Tested by

no test coverage detected