From 1ec3c0d57fdc1599f7dcadde67aff0a67b1990b2 Mon Sep 17 00:00:00 2001 From: Vladyslav Fedoriuk Date: Sun, 6 Aug 2023 00:52:54 +0200 Subject: [PATCH] Add ReadTimeout for errors to retry for in SourceGraph client --- app/source_graph/client.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/source_graph/client.py b/app/source_graph/client.py index 29ecdd5..b954b52 100644 --- a/app/source_graph/client.py +++ b/app/source_graph/client.py @@ -90,7 +90,9 @@ class AsyncSourceGraphSSEClient: self: Self, **kwargs: MutableMapping[str, Any] ) -> AsyncGenerator[ServerSentEvent, None]: """Iterate over the SourceGraph SSE API with retries.""" - async for attempt in stamina.retry_context(on=httpx.ReadError): + async for attempt in stamina.retry_context( + on=(httpx.ReadError, httpx.ReadTimeout) + ): with attempt: await asyncio.sleep(self._reconnection_delay) async for event in self._aiter_sse(**kwargs):