Repository navigation
perf(review-items): Batch webhook review item closes and memoize conversation access - #3456
Open
sentry[bot] wants to merge 2 commits into
Open
sentry[bot] wants to merge 2 commits into
sentry[bot] wants to merge 2 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
14 screenshot changes — 14 changed · 0 added · 0 removed Review screenshots in Frameshift Show 8 more changed screenshots |
This branch was successfully 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.
Problem
Every pull request webhook delivery that checked a pull request triggered an N+1 query issue in
POST /api/webhooks/github(Sentry issue JUNIOR-XD). Inpull-request-action.ts,syncOnemade three sequential calls toitems.close()(two for legacy item prefixes and one for the merge-conflict notice). Each call tocreatePluginReviewItems().close()re-fetched the conversation access from the database (readConversationAccessFromSql) and performed an individual SQL select bydedupe_keyagainstjunior_review_items, causing 6 database queries per pull request check.In addition, a recent merge on
mainleftreadLinkObjectTypereferencing.objectTypeinstead of.objectTypesonObjectLinkType, causing CI typecheck and lint to fail.Solution
closeManytoPluginReviewItemsin@sentry/junior-plugin-apiand implementedgetOpenReviewItemsByDedupeKeysinchat/review-items/store.tsusinginArrayto fetch matching open review items in a single query.createPluginReviewItemsso subsequent review-item operations on the same conversation reuse the access read and avoid repeating the join query.syncOneinpull-request-action.tsto collect legacy dedupe keys and any applicable conflict-notice key into a singlecloseManycall, cutting database queries down to 2.readLinkObjectTypeinpackages/junior/src/api/objects/resolve.tsto inspectlinkType.objectTypesinstead of the removed property.Fixes JUNIOR-XD
@sentry <feedback>: Autofix iterates on these changes@sentry stop iterating: Autofix stops iterating on this runThis PR was automatically generated by Sentry. You can adjust this setting at any time.