forked from loafle/openapi-generator-original
python-asyncio: update retry factors for actual exponential retries (#19337)
* python-asyncio: update retry factors for actual exponential retries
As per the `aiohttp-retry` library's code[^1], the timeout is
```python
timeout = self._start_timeout * (self._factor ** attempt)
```
This means the previous setting with "start_timeout=0.0" would have
always just retried right away (0 timeout) regardless of the "factor" value,
and also, "factor=0.0" would never have increased the timeout, rather it
would have resulted in a 0 timeout regardless of the value of "start_timeout".
This double-zeroing effectively rendered exponential backoff to nothing (rather than
"retries" number of retries in quick succession.
The update is a quick fix to set the same default as in `aiohttp-retry`. In
the future this should likely be configurable (through extra Configuration settings perhaps?),
as not all APIs are created equal, but this works as a quick fix for making retries more effective.
[^1]: ba2169891f/aiohttp_retry/retry_options.py (L38-L65)
* updated example
This commit is contained in:
parent
d1b9f9284a
commit
fdd2dc9651
@ -79,8 +79,8 @@ class RESTClientObject:
|
||||
client_session=self.pool_manager,
|
||||
retry_options=aiohttp_retry.ExponentialRetry(
|
||||
attempts=retries,
|
||||
factor=0.0,
|
||||
start_timeout=0.0,
|
||||
factor=2.0,
|
||||
start_timeout=0.1,
|
||||
max_timeout=120.0
|
||||
)
|
||||
)
|
||||
|
@ -89,8 +89,8 @@ class RESTClientObject:
|
||||
client_session=self.pool_manager,
|
||||
retry_options=aiohttp_retry.ExponentialRetry(
|
||||
attempts=retries,
|
||||
factor=0.0,
|
||||
start_timeout=0.0,
|
||||
factor=2.0,
|
||||
start_timeout=0.1,
|
||||
max_timeout=120.0
|
||||
)
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user