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

Method _raise_wait_queue_timeout

pymongo/synchronous/pool.py:1438–1475  ·  view source on GitHub ↗
(self, checkout_started_time: float)

Source from the content-addressed store, hash-verified

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

Callers 1

_get_connMethod · 0.95

Calls 3

_debug_logFunction · 0.90

Tested by

no test coverage detected