Add ReadTimeout for errors to retry for in SourceGraph client

This commit is contained in:
Vladyslav Fedoriuk 2023-08-06 00:52:54 +02:00
parent ffc62be92a
commit 1ec3c0d57f

View File

@ -90,7 +90,9 @@ class AsyncSourceGraphSSEClient:
self: Self, **kwargs: MutableMapping[str, Any] self: Self, **kwargs: MutableMapping[str, Any]
) -> AsyncGenerator[ServerSentEvent, None]: ) -> AsyncGenerator[ServerSentEvent, None]:
"""Iterate over the SourceGraph SSE API with retries.""" """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: with attempt:
await asyncio.sleep(self._reconnection_delay) await asyncio.sleep(self._reconnection_delay)
async for event in self._aiter_sse(**kwargs): async for event in self._aiter_sse(**kwargs):