Retry decorator on RateLimitExceeded issue

オープン
#1,577 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python
領域
backend, cloud

調査の方向性

まず libcloud/common/base.py の retry デコレーターとリクエストフローを追跡し、次に libcloud/common/azure_arm.py の Azure ARM パスを、レポートに示されている azure_arm ドライバーの呼び出しと比較します。設定されたレート制限のケースを再現し、返された 429 がどのように RateLimitReachedError になるかを特定します。retry ロジックが有効な場合に、レート制限レスポンスに対する retry の動作が機能すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

stale

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:

while True:
    nodes = driver.list_nodes()
    print(nodes)

Hitting the throttling limit results in:

  Traceback (most recent call last):
  File "test.py", line 23, in <module>
    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 based on HTTP status codes, maybe use this? Let me know how you think this should be handled

主要言語
Python
スター
2.1k
フォーク
935
平均マージ
5日 3時間
マージ済み PR(30日)
15

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

apache/libcloud のほかの issue

apache/libcloud の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。