Skip to content

perf(cron): backpressure the re-gate sweep on the GitHub REST budget - #1483

Merged
JSONbored merged 1 commit into
mainfrom
claude/cron-backpressure
Jun 26, 2026
Merged

perf(cron): backpressure the re-gate sweep on the GitHub REST budget#1483
JSONbored merged 1 commit into
mainfrom
claude/cron-backpressure

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

The auto-maintain re-gate sweep — the heaviest GitHub-budget consumer (per-repo + per-PR live CI + mergeable fetches) — was enqueued unconditionally every ~2-minute cron tick. On a busy install it competed with webhooks for the shared hourly REST bucket and compounded the backlog.

The sweep is now skipped for a tick when the REST budget is already at/below MAINTENANCE_RESERVED_HEADROOM (150), reserving the remaining budget for webhooks (which drive timely reviews). The next tick (~2 min) retries, and the sweep resumes once the bucket resets. Webhooks never pre-yield. This reuses the existing shouldWaitForGitHubRateLimit gate, so it works on cloud and self-host.

Validation

  • npm run typecheck; npm run test:coverage — full suite green; 100% changed lines + branches (a low-budget observation throttles the sweep; the existing tests cover the normal enqueue).

Roadmap item #6 (throughput / fairness).

The auto-maintain sweep — the heaviest GitHub-budget consumer (per-repo + per-PR
live CI + mergeable fetches) — was enqueued unconditionally every ~2-minute cron
tick, so on a busy install it competed with webhooks for the shared hourly REST
bucket and compounded the backlog. The sweep is now skipped for a tick when the
budget is already at/below MAINTENANCE_RESERVED_HEADROOM, reserving the remaining
budget for webhooks (which drive timely reviews); the next tick retries and the
sweep resumes after the bucket resets. Webhooks never pre-yield.
@dosubot dosubot Bot added the size:S label Jun 26, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.44%. Comparing base (6543e3c) to head (4d09fd6).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1483   +/-   ##
=======================================
  Coverage   95.44%   95.44%           
=======================================
  Files         194      194           
  Lines       21070    21074    +4     
  Branches     7624     7625    +1     
=======================================
+ Hits        20110    20114    +4     
  Misses        383      383           
  Partials      577      577           
Files with missing lines Coverage Δ
src/index.ts 91.48% <100.00%> (+0.79%) ⬆️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JSONbored
JSONbored merged commit b2afdb5 into main Jun 26, 2026
18 checks passed
@JSONbored
JSONbored deleted the claude/cron-backpressure branch June 26, 2026 11:23
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.

1 participant