Handle rate limit headers in client, adjust request throttling#61
Handle rate limit headers in client, adjust request throttling#61
Conversation
…vided in headers Signed-off-by: Eric Pickard <piceri@github.com>
Signed-off-by: Eric Pickard <piceri@github.com>
… limits to match github secondary rate limits Signed-off-by: Eric Pickard <piceri@github.com>
Signed-off-by: Eric Pickard <piceri@github.com>
There was a problem hiding this comment.
Pull request overview
Updates the deployment record client to better handle GitHub API rate limiting by deriving a shared backoff from response headers and applying a renamed/request throttling mechanism across workers.
Changes:
- Add shared, cross-goroutine rate-limit backoff based on
Retry-AfterandX-Ratelimit-Resetheaders. - Rename
rateLimitertorequestThrottlerand adjust the default throughput configuration. - Add
User-Agentheader and extend tests to cover rate-limit delay parsing and cross-goroutine behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| pkg/deploymentrecord/client.go | Implements server-driven backoff using rate-limit headers, renames/throttles request limiter, and adds a User-Agent. |
| pkg/deploymentrecord/client_test.go | Updates existing rate-limit tests and adds new unit/concurrency tests for rate-limit delay parsing and shared backoff behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Eric Pickard <piceri@github.com>
ajbeattie
left a comment
There was a problem hiding this comment.
LGTM, with a +1 on the Copilot comment about either removing the max 60 second Retry After or adding a note explaining it.
Signed-off-by: Eric Pickard <piceri@github.com>
Thanks! Removed the check, secondary rate limits should reset every min but it should be good enough to trust the header value. |
This request:
Retry-AfterandX-Ratelimit-Resetheaders are both checked, largest delay is appliedrateLimitertorequestThrottlerand lowered throughput to 180 requests/minUser-Agentto client request to quickly distinguish Deployment Tracker requests,