mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-09 21:29:11 +00:00
Retry api calls to gemini on network read error
This commit is contained in:
@@ -76,7 +76,11 @@ def _is_retryable_error(exception: BaseException) -> bool:
|
|||||||
if isinstance(exception, gerrors.APIError):
|
if isinstance(exception, gerrors.APIError):
|
||||||
return exception.code in [429, 502, 503, 504]
|
return exception.code in [429, 502, 503, 504]
|
||||||
# client errors
|
# client errors
|
||||||
if isinstance(exception, httpx.TimeoutException) or isinstance(exception, httpx.NetworkError):
|
if (
|
||||||
|
isinstance(exception, httpx.TimeoutException)
|
||||||
|
or isinstance(exception, httpx.NetworkError)
|
||||||
|
or isinstance(exception, httpx.ReadError)
|
||||||
|
):
|
||||||
return True
|
return True
|
||||||
# validation errors
|
# validation errors
|
||||||
if isinstance(exception, ValueError):
|
if isinstance(exception, ValueError):
|
||||||
|
|||||||
Reference in New Issue
Block a user