Repository navigation
fix(rollups): read the source order once per request - #1578
Merged
Merged
Conversation
The day readers memoised the user's source-priority read under their own key, while some sixty other readers called loadUserSourcePriority directly. A digest request reached it from both sides; parallel direct reads went to Prisma, which batched whichever landed in the same tick, so the route sent the read in three to five statements and its count followed the scheduling. loadUserSourcePriority now shares one pending read per request under one key (fresh in a background event, as before), and the day readers use it. The budgets of the summary, snapshot, digest and health status drop to the counts measured on the fixture.
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.
The day readers memoised the source-priority read under their own key while every other reader called
loadUserSourcePrioritydirectly; Prisma batched whichever parallel reads landed in the same tick, so the digest sent the read in three to five statements and its budget flickered between 131 and 132 (main red on the Integration run of 8a6d407).loadUserSourcePrioritynow shares one pending read per request (fresh in background events, unchanged outside an event); the day readers use it andday-source-priority.tsgoes. A unit test fails if one request reads the row twice, parallel callers and the day reader included.Budgets lowered to the measured counts (three identical local runs): summary 38 → 37, snapshot 88 → 86, digest 131 → 128, health status 59 → 51.