Skip to content

Commit 33bfe35

Browse files
committed
Use exponential growing retry timeout
1 parent 2f9fd3c commit 33bfe35

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tests/test_convertapi.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,14 @@ def test_polling_too_fast_and_getting_202_accepted(self):
111111
raise AssertionError
112112

113113

114+
retry_sleep_base_timeout = 0.1
115+
114116
def get_poll_result(job_id, retry_count=5):
115117
try:
116118
result = convertapi.async_poll(job_id)
117-
except Exception as error:
119+
except convertapi.ApiError:
118120
if retry_count > 0:
119-
time.sleep(0.1)
121+
time.sleep((1 + 0.1) ** (5 - retry_count) - 1)
120122
return get_poll_result(job_id, retry_count=retry_count - 1)
121123
else:
122124
raise error

0 commit comments

Comments
 (0)