Skip to content

Commit f8d0bbf

Browse files
feat(client): retry on 408 Request Timeout (#99)
1 parent ada3ad6 commit f8d0bbf

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,8 @@ Error codes are as followed:
210210
### Retries
211211

212212
Certain errors will be automatically retried 2 times by default, with a short exponential backoff.
213-
Connection errors (for example, due to a network connectivity problem), 409 Conflict, 429 Rate Limit,
214-
and >=500 Internal errors will all be retried by default.
213+
Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,
214+
429 Rate Limit, and >=500 Internal errors will all be retried by default.
215215

216216
You can use the `max_retries` option to configure or disable this:
217217

src/finch/_base_client.py

+4
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,10 @@ def _should_retry(self, response: httpx.Response) -> bool:
644644
if should_retry_header == "false":
645645
return False
646646

647+
# Retry on request timeouts.
648+
if response.status_code == 408:
649+
return True
650+
647651
# Retry on lock timeouts.
648652
if response.status_code == 409:
649653
return True

0 commit comments

Comments
 (0)