Skip to content

Commit 6254bd0

Browse files
authored
Switch to exponential wait, fixes #106
1 parent 8a3b89c commit 6254bd0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

semanticscholar/ApiRequester.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66

77
import httpx
88
from tenacity import retry as rerun
9-
from tenacity import retry_if_exception_type, stop_after_attempt, wait_fixed
9+
from tenacity import retry_if_exception_type, \
10+
stop_after_attempt, \
11+
wait_exponential
1012

1113
from semanticscholar.SemanticScholarException import (
1214
BadQueryParametersException, GatewayTimeoutException,
@@ -94,7 +96,7 @@ async def get_data_async(
9496
)(self, url, parameters, headers, payload)
9597

9698
@rerun(
97-
wait=wait_fixed(30),
99+
wait=wait_exponential(min=5),
98100
retry=retry_if_exception_type(ConnectionRefusedError),
99101
stop=stop_after_attempt(10)
100102
)

0 commit comments

Comments
 (0)