merge-queue reads only what a delivery says changed #16
Loading…
Reference in a new issue
No description provided.
Delete branch "forgejo-56-mq-reads"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Work package: https://openproject.home.romaine.life/wp/FORGEJO-56
merge-queue was Forgejo's busiest client: 594 requests in about 70 seconds tonight (241 open-PR lists, 217 repository reads, 52 status reads, 50 timelines, 24 compares). Every delivery, each CI job on any repository included, brought a full look at its repository.
Removed: the full read per delivery (repository, every open pull request, every queued one's timeline and statuses).
Added:
model.go: what the last look read of each repository (the repository, its queued pull requests, each one's label time and head statuses, and heads found up to date with their base), and what each delivery marks changed.commit_statusnever looks. The look then reads only what was marked: that PR, its timeline when its labels changed, and that head's statuses.X-Total-Countinstead of reading an empty last page.merge_queue_webhook_looked_totalandmerge_queue_webhook_dropped_totalby event, andmerge_queue_forgejo_requests_totalby method.Left alone: every decision rule in the README, the startup read, one look per repository at a time, and the retry after a failed look. Its own status writes are read back once by the next look, so the hand-back rerun keeps comparing against Forgejo's times.
What this trades: a lost delivery is no longer repaired by the next unrelated event, only by the next one touching that PR, a failed look, or a restart. A lost push to the base could let the front merge without being updated first; Forgejo's branch protection still guards that.
Tested:
go testpasses. The existing decision tests are unchanged except that they deliver real payloads. New tests inreads_test.gocover: a job after a failed look reads the repository whole and lands the PR (TestAJobAfterAFailedLookReadsTheRepositoryWholeAndLands, which fails without the fix); a job on an unqueued head, a repository with nothing queued, an unrelated push, an unqueued PR and the queue's own status all make zero requests; a job on a queued head reads only that head's statuses; the label added and removed by its event; a push to the base updating the front; the repository taken from the event; and lists stopping at the total. The image's--self-testpasses.Expected rate from tonight's measured events: the drops cost nothing, and a job on a queued head costs one status read, coalesced per repository. That is at most about 0.75 requests a second at tonight's peak job rate, against about 8.5 measured.
🤖 Generated with Claude Code
6cd27c33528016bc6316