Skip to content

Commit

Permalink
bump to MAX_RETRIES = 50
Browse files Browse the repository at this point in the history
  • Loading branch information
ric-evans committed Aug 22, 2023
1 parent 632317c commit 0a442eb
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions rest_tools/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from ..utils.json_util import JSONType, json_decode
from .session import AsyncSession, Session

MAX_RETRIES = 15
MAX_RETRIES = 50


def _to_str(s: Union[str, bytes]) -> str:
Expand Down Expand Up @@ -81,8 +81,8 @@ def calculate_retries(self, timeout: float, backoff_factor: float) -> int:
# the first backoff is always 0 sec, factor applies after 2nd attempt
# T + 0 + sum{n=1,retries-1}(T + min[MAX, 2^n * B] ) + T
# sum has no closed form due to `min` function
for candidate in range(0, MAX_RETRIES + 2): # last val -> MAX_RETRIES+1
if self.waittime_max > (
for candidate in range(0, MAX_RETRIES + 2): # last val is MAX_RETRIES+1
total = (
timeout
+ 0
+ sum(
Expand All @@ -94,7 +94,10 @@ def calculate_retries(self, timeout: float, backoff_factor: float) -> int:
for n in range(1, candidate) # 1 to retries-1 (inclusive)
)
+ timeout
):
)
# print(candidate)
# print(total)
if self.waittime_max > total:
retries = candidate # gets overwritten each iteration
else:
break
Expand Down

0 comments on commit 0a442eb

Please sign in to comment.