Skip to content

Commit 974f74b

Browse files
authored
Update request_utils.py (#163)
Tweak retry values to be more robust: Should be equivalent to wait-time-values-between-retries and cumulative-time-between-tries of (in seconds): ``` >>> a = [min(math.floor(3 * (1.88 ** i)), 720) for i in range(10)]; a; [sum(a[:i+1]) for i in range(len(a))] [3, 5, 10, 19, 37, 70, 132, 249, 468, 720] [3, 8, 18, 37, 74, 144, 276, 525, 993, 1713] ```
1 parent 5ae2f46 commit 974f74b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/unstructured_client/_hooks/custom/request_utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ async def send_request_async_with_retries(client: httpx.AsyncClient, request: ht
8181
retry_config = utils.RetryConfig(
8282
"backoff",
8383
utils.BackoffStrategy(
84-
initial_interval=2000,
85-
max_interval=60000,
86-
exponent=1.5,
87-
max_elapsed_time=1000 * 60 * 5 # 5 minutes
84+
initial_interval=3000, # 3 seconds
85+
max_interval=1000 * 60 * 12, # 12 minutes
86+
exponent=1.88,
87+
max_elapsed_time=1000 * 60 * 30 # 30 minutes
8888
),
8989
retry_connection_errors=True
9090
)

0 commit comments

Comments
 (0)