Lack of built-in retry mechanism for handling transient network errors and rate limits
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 38/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- python
調査の方向性
Read the synchronous and asynchronous client constructors and the HTTP request paths for Client, AsyncClient, OauthClient, and AsyncOauthClient. Check how the SDK handles network errors, response status codes, and Retry-After headers, then identify the tests covering those paths. Done means opt-in retries work across all four clients with backoff, jitter, rate-limit handling, and the stated defaults.
索引モデルが issue の本文から書いたものです。
説明
Currently, the OpenAPI Python SDK is designed with low-level HTTP primitives. If an API request fails due to a transient error, the client raises an error or fails immediately:
- Transient Network Errors: Minor network drops, socket timeouts, or DNS hiccups fail immediately.
- Temporary Server Overloads: Gateway errors (HTTP
502 Bad Gateway,503 Service Unavailable,504 Gateway Timeout) trigger immediate crashes. - Rate Limits (HTTP 429): If the client hits API rate limits, it fails instantly rather than waiting for the reset window.
To handle these scenarios, developers using the SDK must write custom retry loops and catch blocks in their application code, leading to unnecessary boilerplate.
Proposed Feature
Implement an optional, built-in retry mechanism for both synchronous and asynchronous clients (Client, AsyncClient, OauthClient, and AsyncOauthClient).
This retry mechanism should feature:
- Exponential Backoff: Gradually increase wait times between retries (e.g. wait 1s, then 2s, then 4s) to give the server time to recover.
- Jitter (Randomized Noise): Add random variation to the sleep durations to prevent multiple clients from hitting the server at the exact same millisecond.
- Smart Rate-Limit Handling: Automatically detect HTTP 429 status codes, parse the
Retry-Afterheader if available, and sleep for the requested duration before retrying. - Customizable Configuration: Allow developers to configure the retries during client initialization, with safe defaults.
Proposed API Design
Add optional retry parameters to the client constructors:
client = Client(
token="your_token",
max_retries=3, # Number of retry attempts (0 to disable)
backoff_factor=1.0, # Multiplier for exponential sleep delay
retry_on_status=[429, 502, 503, 504] # Status codes that trigger a retry
)
To ensure 100% backward compatibility, max_retries should default to 0 (disabled), ensuring no existing production code or tests are affected unless the developer explicitly opts in.
Benefits
- Resilience: SDK handles transient internet drops and brief server downtime gracefully.
- Ease of Use: Reduces boilerplate code in the consumer's application.
- Backward-Compatible: Defaulting
max_retriesto0guarantees existing behavior is preserved.
- 主要言語
- Python
- スター
- 18
- フォーク
- 4
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
openapi/openapi-python-sdk のほかの issue
-
Rename package to openapi-sdk (PyPI approval in progress)対応中かも @francescobianco が 108 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 15/100
-
難易度 4/5 1〜2日 初心者へのやさしさ 56/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 42/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 42/100
-
good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 55/100
openapi/openapi-python-sdk#9 · コメント 7 件 ·
openapi/openapi-python-sdk の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
aws-samples/sample-per-model-bedrock#243 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
FuRongJun-1999/dsh-memory#404 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
bug frontend
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
PennyLaneAI/catalyst#3337 ·
メンテナーはふだん 1 日以内に返信
-
Workflow.schedule stops when a cron deadline passes before sleep対応中かも @HuaTNA が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信