Skip to content

Commit

Permalink
Merge pull request #10 from caruhome/backoff-expo-max-value
Browse files Browse the repository at this point in the history
upparat: limit exponential backoff max time
  • Loading branch information
livioso authored Mar 3, 2020
2 parents 209af19 + ac0e8b1 commit 62d7e35
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/upparat/statemachine/download.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import functools
import json
import logging
import os
Expand Down Expand Up @@ -33,10 +34,11 @@
# https://stackoverflow.com/questions/28695448/
READ_CHUNK_SIZE_BYTES = 1024 * 100 # 100 kib
REQUEST_TIMEOUT_SEC = 30
BACKOFF_EXPO_MAX_SEC = 2 ** 6 # 64


@backoff.on_exception(
backoff.expo,
functools.partial(backoff.expo, max_value=BACKOFF_EXPO_MAX_SEC),
(URLError, HTTPError, RemoteDisconnected, socket.timeout),
jitter=backoff.full_jitter,
)
Expand Down

0 comments on commit 62d7e35

Please sign in to comment.