Retry decorator on RateLimitExceeded issue
- 主要言語
- Python
- スター
- 2.1k
- フォーク
- 931
- 平均マージ
- 1日 2時間
- マージ済み PR(30日)
- 4
説明
## Summary
Enabling retry logic does not work for rate limit exceeded responses.
## Detailed Information
retry decorator expects a `RateLimitExceeded` error to be raised, though `session.request` method does not raise an exception if a response is returned by the server no matter the status code.
I've tested it on azure_arm driver by setting `RETRY_FAILED_HTTP_REQUESTS` to True and trying:
```python
while True:
nodes = driver.list_nodes()
print(nodes)
```
Hitting the throttling limit results in:
```python
Traceback (most recent call last):
File "test.py", line 23, in
nodes = driver.list_nodes()
File "/home/dimgal/libcloud/libcloud/compute/drivers/azure_arm.py", line 395, in list_nodes
r = self.connection.request(action,
File "/home/dimgal/libcloud/libcloud/common/azure_arm.py", line 227, in request
return super(AzureResourceManagementConnection, self) \
File "/home/dimgal/libcloud/libcloud/common/base.py", line 655, in request
response = responseCls(**kwargs)
File "/home/dimgal/libcloud/libcloud/common/base.py", line 165, in __init__
raise exception_from_message(code=self.status,
libcloud.common.exceptions.RateLimitReachedError: 429 Rate limit exceeded
```
urllib3 supports [retries](https://urllib3.readthedocs.io/en/latest/reference/urllib3.util.html#urllib3.util.Retry) based on HTTP status codes, maybe use this? Let me know how you think this should be handled
コントリビューションガイド
調査の方向性
まず libcloud/common/base.py の retry デコレーターとリクエストフローを追跡し、次に libcloud/common/azure_arm.py の Azure ARM パスを、レポートに示されている azure_arm ドライバーの呼び出しと比較します。設定されたレート制限のケースを再現し、返された 429 がどのように RateLimitReachedError になるかを特定します。retry ロジックが有効な場合に、レート制限レスポンスに対する retry の動作が機能すれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- backend, cloud
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100