(self, checkout_started_time: float)
| 1440 | return False |
| 1441 | |
| 1442 | def _raise_wait_queue_timeout(self, checkout_started_time: float) -> NoReturn: |
| 1443 | listeners = self.opts._event_listeners |
| 1444 | duration = time.monotonic() - checkout_started_time |
| 1445 | if self.enabled_for_cmap: |
| 1446 | assert listeners is not None |
| 1447 | listeners.publish_connection_check_out_failed( |
| 1448 | self.address, ConnectionCheckOutFailedReason.TIMEOUT, duration |
| 1449 | ) |
| 1450 | if self.enabled_for_logging and _CONNECTION_LOGGER.isEnabledFor(logging.DEBUG): |
| 1451 | _debug_log( |
| 1452 | _CONNECTION_LOGGER, |
| 1453 | message=_ConnectionStatusMessage.CHECKOUT_FAILED, |
| 1454 | clientId=self._client_id, |
| 1455 | serverHost=self.address[0], |
| 1456 | serverPort=self.address[1], |
| 1457 | reason="Wait queue timeout elapsed without a connection becoming available", |
| 1458 | error=ConnectionCheckOutFailedReason.TIMEOUT, |
| 1459 | durationMS=duration, |
| 1460 | ) |
| 1461 | timeout = _csot.get_timeout() or self.opts.wait_queue_timeout |
| 1462 | if self.opts.load_balanced: |
| 1463 | other_ops = self.active_sockets - self.ncursors - self.ntxns |
| 1464 | raise WaitQueueTimeoutError( |
| 1465 | "Timeout waiting for connection from the connection pool. " |
| 1466 | "maxPoolSize: {}, connections in use by cursors: {}, " |
| 1467 | "connections in use by transactions: {}, connections in use " |
| 1468 | "by other operations: {}, timeout: {}".format( |
| 1469 | self.opts.max_pool_size, |
| 1470 | self.ncursors, |
| 1471 | self.ntxns, |
| 1472 | other_ops, |
| 1473 | timeout, |
| 1474 | ) |
| 1475 | ) |
| 1476 | raise WaitQueueTimeoutError( |
| 1477 | "Timed out while checking out a connection from connection pool. " |
| 1478 | f"maxPoolSize: {self.opts.max_pool_size}, timeout: {timeout}" |
| 1479 | ) |
| 1480 | |
| 1481 | def __del__(self) -> None: |
| 1482 | # Avoid ResourceWarnings in Python 3 |
no test coverage detected