feat: add configurable rate limiting with exponential backoff#477
Draft
feat: add configurable rate limiting with exponential backoff#477
Conversation
Co-authored-by: zkoppert <6935431+zkoppert@users.noreply.github.com>
- Add RateLimiter class with token bucket algorithm - Add configurable rate limiting via environment variables - Integrate rate limiting into all GitHub API calls - Add comprehensive test suite for rate limiting - Update environment variable handling and tests - All tests passing with 97% code coverage Co-authored-by: zkoppert <6935431+zkoppert@users.noreply.github.com>
- Document RATE_LIMIT_ENABLED environment variable - Document RATE_LIMIT_REQUESTS_PER_SECOND environment variable - Document RATE_LIMIT_BACKOFF_FACTOR environment variable - Document RATE_LIMIT_MAX_RETRIES environment variable - Add dedicated Rate Limiting section in configuration Co-authored-by: zkoppert <6935431+zkoppert@users.noreply.github.com>
Signed-off-by: Zack Koppert <zkoppert@github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Proposed Changes
Implements configurable rate limiting to prevent workflow failures from exceeding GitHub API rate limits when processing multiple repositories.
Core Implementation
Rate Limiter Module (
rate_limiter.py):requestslibrary calls (GET, PUT, POST) and GraphQL queriesConfiguration (defaults in parentheses):
RATE_LIMIT_ENABLED(true) - Toggle rate limitingRATE_LIMIT_REQUESTS_PER_SECOND(2.0) - Max requests/secondRATE_LIMIT_BACKOFF_FACTOR(2.0) - Retry wait multiplierRATE_LIMIT_MAX_RETRIES(3) - Max retry attemptsIntegration Points:
is_dependabot_security_updates_enabled()enable_dependabot_security_updates()get_global_project_id(),get_global_issue_id(),get_global_pr_id()link_item_to_project()Usage Example
Test Coverage
Readiness Checklist
Author/Contributor
make lintand fix any issues that you have introducedmake testand ensure you have test coverage for the lines you are introducing@jeffrey-luszczReviewer
fix,documentation,enhancement,infrastructure,maintenanceorbreakingOriginal prompt