in elastic_transport/_node_pool.py [0:0]
def mark_dead(self, node: BaseNode, _now: Optional[float] = None) -> None:
"""
Mark the node as dead (failed). Remove it from the live pool and put it on a timeout.
:arg node: The failed node.
"""
now: float = _now if _now is not None else time.time()
try:
del self._alive_nodes[node.config]
except KeyError:
pass
consecutive_failures = self._dead_consecutive_failures[node.config] + 1
self._dead_consecutive_failures[node.config] = consecutive_failures
try:
timeout = min(
self._dead_node_backoff_factor * (2 ** (consecutive_failures - 1)),
self._max_dead_node_backoff,
)
except OverflowError:
timeout = self._max_dead_node_backoff
self._dead_nodes.put((now + timeout, node))
_logger.warning(
"Node %r has failed for %i times in a row, putting on %i second timeout",
node,
consecutive_failures,
timeout,
)