You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
classExponentialRetry(RetryOptionsBase):
def__init__(
self,
attempts: int=3, # How many times we should retrystart_timeout: float=0.1, # Base timeout time, then it exponentially growmax_timeout: float=30.0, # Max possible timeout between triesfactor: float=2.0, # How much we increase timeout each timestatuses: Optional[Set[int]] =None, # On which statuses we should retryexceptions: Optional[Set[Type[Exception]]] =None, # On which exceptions we should retryretry_all_server_errors: bool=True,
evaluate_response_callback: Optional[EvaluateResponseCallbackType] =None,
):
Based on the comments, I expect the first retry to happen start_timeout seconds after the original try. I expect the second retry to happen start_timeout * factor seconds after the first retry, and so on.
Observed Behavior
Instead, the first retry happens start_timeout * factor seconds after the original try. The second retry happens start_timeout * factor**2 seconds after that and so on. All the retries seem to be off by a factor of factor.
I confirmed this by logging requests I sent to a local server. I used this RetryClient:
Background and Expected Behavior
ExponentialRetry
takes in the following arguments:Based on the comments, I expect the first retry to happen
start_timeout
seconds after the original try. I expect the second retry to happenstart_timeout * factor
seconds after the first retry, and so on.Observed Behavior
Instead, the first retry happens
start_timeout * factor
seconds after the original try. The second retry happensstart_timeout * factor**2
seconds after that and so on. All the retries seem to be off by a factor offactor
.I confirmed this by logging requests I sent to a local server. I used this
RetryClient
:and I observed the following timings (note that the first retry happens 2 seconds after the first attempt– not 1 second):
Potential Cause
I believe the issue is that
_RequestContext
1-indexes each attempt, but the math inExponentialRetry
expects 0-indexing.The text was updated successfully, but these errors were encountered: