Skip to content

fix(ratelimit): no longer stall after rate limit reset - #89

Merged
tstollin merged 1 commit into
mainfrom
rate-limit-fix
Jul 29, 2026
Merged

fix(ratelimit): no longer stall after rate limit reset#89
tstollin merged 1 commit into
mainfrom
rate-limit-fix

Conversation

@tstollin

@tstollin tstollin commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Fix: Rate limit stall recovery after reset window expires

Problem

After hitting a GitHub API rate limit, the operator correctly stalled reconciliations but never resumed — even hours after the rate limit reset (which happens every hour).

Root cause: When the rate limit reset time passed, ShouldStall() still returned stalled=true with delay=0 because the cached Remaining value was still below threshold. Since stalling prevented any API calls, the rateLimitTrackerTransport never recorded fresh headers — creating a deadlock.

Fix

  1. internal/ratelimit/org_registry.go — In ShouldStall(), skip stalling when the reset time (+ grace period) has already passed. The old Remaining is stale; letting the request through allows the transport to refresh the registry.

  2. internal/controller/shared.go — Added a minimum 30s requeue delay (max(time.Until(resetTime), 30s)) as a safety net against tight-looping if a RateLimitedError ever carries a past reset time.

@tstollin
tstollin requested a review from a team as a code owner July 29, 2026 10:59
@tstollin
tstollin merged commit 4448190 into main Jul 29, 2026
10 checks passed
@tstollin
tstollin deleted the rate-limit-fix branch July 29, 2026 11:13
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.7.1 🎉

The release is available on GitHub release and as container image ghcr.io/interhyp/git-hubby:0.7.1

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants