Return (Hello, round_trip_time). Can raise ConnectionFailure or OperationFailure.
(self, conn: AsyncConnection)
| 352 | return sd |
| 353 | |
| 354 | async def _check_with_socket(self, conn: AsyncConnection) -> tuple[Hello, float]: # type: ignore[type-arg] |
| 355 | """Return (Hello, round_trip_time). |
| 356 | |
| 357 | Can raise ConnectionFailure or OperationFailure. |
| 358 | """ |
| 359 | start = time.monotonic() |
| 360 | if conn.more_to_come: |
| 361 | # Read the next streaming hello (MongoDB 4.4+). |
| 362 | response = Hello(await conn._next_reply(), awaitable=True) |
| 363 | elif ( |
| 364 | self._stream and conn.performed_handshake and self._server_description.topology_version |
| 365 | ): |
| 366 | # Initiate streaming hello (MongoDB 4.4+). |
| 367 | response = await conn._hello( |
| 368 | self._server_description.topology_version, |
| 369 | self._settings.heartbeat_frequency, |
| 370 | ) |
| 371 | else: |
| 372 | # New connection handshake or polling hello (MongoDB <4.4). |
| 373 | response = await conn._hello(None, None) |
| 374 | duration = _monotonic_duration(start) |
| 375 | return response, duration |
| 376 | |
| 377 | |
| 378 | class SrvMonitor(MonitorBase): |
no test coverage detected