Skip to content

fix: coordinate REST API rate limits and bound retries - #618

Merged
KAJdev merged 7 commits into
mainfrom
zeke/rest-api-rate-limits
Nov 3, 2026
Merged

KAJdev merged 7 commits into
mainfrom
zeke/rest-api-rate-limits

Conversation

@KAJdev

@KAJdev KAJdev commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Honor Retry-After and use jittered exponential backoff when no valid hint is available. Retry and wait budgets surface RateLimitError when exhausted.

Comment thread tests/test_api/test_rate_limit.py Fixed
Comment thread runpod/api/_rate_limit.py Fixed
Comment thread tests/test_api/test_rate_limit.py Fixed
Comment thread tests/test_api/test_rate_limit.py Fixed
Comment thread tests/test_api/test_rate_limit.py Fixed
Comment thread runpod/api/_rate_limit.py Fixed
@KAJdev
KAJdev requested a review from deanq October 14, 2026 22:20
@deanq
deanq requested a balanced review from Copilot October 15, 2026 00:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Quota reconciliation can incorrectly block available capacity, and retry-delay calculation and reporting need correction.

4 open findings
What changed in this PR

Adds coordinated rate-limit handling to the management REST transport for synchronous and asynchronous callers.

Changes:

  • Shares quota reservations across routes by origin and API key.
  • Adds bounded retries, Retry-After handling, and jittered backoff.
  • Introduces RateLimitError, documentation, and regression tests.
File Description
tests/​test_api/​test_rate_limit.py Tests quota coordination, retries, budgets, and cancellation.
runpod/​error.py Adds RateLimitError with retry-delay details.
runpod/​api/​rest.py Integrates shared quotas and bounded retries.
runpod/​api/​_rate_limit.py Implements parsing, reservations, cooldowns, and registry management.
docs/​api/​handling_errors.md Documents rate-limit behavior and configuration.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread runpod/api/_rate_limit.py Resolved
Comment thread runpod/api/_rate_limit.py Resolved
Comment thread runpod/api/_rate_limit.py Resolved
Comment thread runpod/api/_rate_limit.py Resolved

@deanq deanq left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

10 inline comments below.

Comment thread runpod/api/_rate_limit.py Resolved
Comment thread runpod/api/_rate_limit.py Resolved
Comment thread runpod/api/_rate_limit.py Resolved
Comment thread runpod/api/_rate_limit.py Resolved
Comment thread runpod/api/rest.py Resolved
Comment thread runpod/api/_rate_limit.py Resolved
Comment thread runpod/api/_rate_limit.py Resolved
Comment thread runpod/api/rest.py Resolved
Comment thread runpod/api/_rate_limit.py Resolved
Comment thread runpod/api/_rate_limit.py Resolved
Comment thread runpod/api/_rate_limit.py Dismissed
Comment thread tests/test_api/test_rate_limit.py Resolved
Comment thread tests/test_api/test_rate_limit.py Resolved
@KAJdev
KAJdev requested a review from deanq October 20, 2026 20:02
@KAJdev
KAJdev merged commit d6ce9a8 into main Nov 3, 2026
6 of 9 checks passed
@KAJdev
KAJdev deleted the zeke/rest-api-rate-limits branch November 3, 2026 00:02
@promptless

promptless Bot commented Nov 3, 2026

Copy link
Copy Markdown

Promptless documentation updates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants