Repository navigation
fix(15036): PR sync pass every 10 min on a shared cache tick - #7
Draft
MattRiddell wants to merge 1 commit into
Draft
MattRiddell wants to merge 1 commit into
MattRiddell wants to merge 1 commit into
Conversation
…ry minute PullRequestSyncReactor swept every minute. Open pull requests are always due, cache entries expired 10 min after their own read, and every finished run invalidates its project's entries, so each minute found a few stale PRs and sent them as their own GraphQL document: ~50/h, 1,213 getPullRequestSummary calls on 2026-10-13. - PullRequestReadCache: entries expire at the next 10-min tick since the epoch (entryExpiresAt), so entries read at different times go stale together. No entry lives longer than ENTRY_TTL. - PullRequestSyncReactor: the periodic pass runs 1 s after each tick (nextPassDelay), so it finds them stale together and reads them in shared documents of 25. Requested syncs still run at once. Badge data is at most one tick old when the pass writes it (Matt, q3440: PR badges can lag up to 10 min). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Thread transfer impact
This comment will update automatically after the next completed run. |
This branch has not been deployed
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.
Board pingdotgg#15036 (fork patch; stacks on #6).
Why:
PullRequestSyncReactorswept every minute. Open PRs are always due. Cache entries expired 10 min after their own read. Every finished run invalidates its project's entries. So each minute found a few stale PRs and sent them as their own GraphQL document: ~50/h, 1,213getPullRequestSummarycalls on 2026-10-13 (fleet/api-calls, unit t3-server).Change
PullRequestReadCache: an entry expires at the next 10-min tick since the epoch (entryExpiresAt). No entry lives longer thanENTRY_TTL; scope invalidations still lastENTRY_TTLfrom now, so they outlive every entry.PullRequestSyncReactor: the periodic pass runs 1 s after each tick (nextPassDelay, markerPASS_AFTER_TICK_MS). Stale PRs are read together, 25 per document. Requested syncs (new link, merge a reader saw, run that rangh pr merge) still run at once.Lag: badge data is at most one tick old when the pass writes it. Matt, q3440: "PR badges can lag up to 10 min".
Projection: summary ≈ 144 documents/day (one per pass) + listPullRequestsByHead 121 ≈ 265/day, under the 283 target.
Tests (local, once each, suite-gate):
PullRequestSyncReactor.test.ts+PullRequestReadCache.test.ts: 34/34 pass. New: pass waits for the tick, not every minute; entries read at different times expire together; no entry outlives ENTRY_TTL. Adjusted: 15-min closed-PR rediscovery, rate-limit retryAt, scope-compaction start time.PullRequestService.test.ts: 187 pass, 3 fail. The same 3 fail on base ebddc2c without this change (pre-existing).tsc --noEmit(apps/server): 0 errors.vp fmt --check/vp linton the 4 files: clean (2 pre-existing warnings).🤖 Generated with Claude Code