From 0a442ebdbcc198a0876f4c17909d7d5f4f0e4d48 Mon Sep 17 00:00:00 2001 From: Ric Evans Date: Tue, 22 Aug 2023 16:51:14 -0500 Subject: [PATCH] bump to `MAX_RETRIES = 50` --- rest_tools/client/client.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/rest_tools/client/client.py b/rest_tools/client/client.py index 54d2b666..181c3a88 100644 --- a/rest_tools/client/client.py +++ b/rest_tools/client/client.py @@ -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: @@ -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( @@ -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