Skip to content

Commit 37b5b8f

Browse files
authored
Improve backoff mechanism for TimeoutError (#1921)
A first try to fix #154906. We will need to add better debug logging to Overkiz in core, to see the `backoff` retries and also understand if `TimeoutError` or `ClientConnectorError` is raised. Adding `retry_on_execution_queue_full` for future purposes.
1 parent 13ca41d commit 37b5b8f

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

pyoverkiz/client.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,17 @@ async def refresh_listener(invocation: Mapping[str, Any]) -> None:
105105
# Reusable backoff decorators to reduce code duplication
106106
retry_on_auth_error = backoff.on_exception(
107107
backoff.expo,
108-
(NotAuthenticatedException, ServerDisconnectedError, ClientConnectorError),
108+
(NotAuthenticatedException, ServerDisconnectedError),
109109
max_tries=2,
110110
on_backoff=relogin,
111111
)
112112

113+
retry_on_connection_failure = backoff.on_exception(
114+
backoff.expo,
115+
(TimeoutError, ClientConnectorError),
116+
max_tries=5,
117+
)
118+
113119
retry_on_concurrent_requests = backoff.on_exception(
114120
backoff.expo,
115121
TooManyConcurrentRequestsException,
@@ -129,6 +135,11 @@ async def refresh_listener(invocation: Mapping[str, Any]) -> None:
129135
on_backoff=refresh_listener,
130136
)
131137

138+
retry_on_execution_queue_full = backoff.on_exception(
139+
backoff.expo,
140+
ExecutionQueueFullException,
141+
max_tries=5,
142+
)
132143

133144
# pylint: disable=too-many-instance-attributes, too-many-branches
134145

@@ -585,6 +596,7 @@ async def register_event_listener(self) -> str:
585596
@retry_on_concurrent_requests
586597
@retry_on_auth_error
587598
@retry_on_listener_error
599+
@retry_on_connection_failure
588600
async def fetch_events(self) -> list[Event]:
589601
"""Fetch new events from a registered event listener. Fetched events are removed.
590602

0 commit comments

Comments
 (0)