This repository was archived by the owner on Dec 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 408
Avoid stalls caused by large diffs fetched from GitHub #2195
Merged
Conversation
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
Codecov Report
@@ Coverage Diff @@
## master #2195 +/- ##
=========================================
- Coverage 92.72% 92.7% -0.02%
=========================================
Files 215 216 +1
Lines 12269 12350 +81
Branches 1796 1814 +18
=========================================
+ Hits 11376 11449 +73
- Misses 893 901 +8
Continue to review full report at Codecov.
|
Contributor
Author
|
cc @jasonrudolph and @nathansobo who brought this to our attention 😄 |
Contributor
Author
|
Lol okay then: |
Contributor
Author
|
It looks like GitHub itself marks review comments as "outdated" on files with patches that grow beyond 1MB, so I'll match that threshold here. Should be good to go 👌 |
Contributor
|
Thanks for digging into this, @smashwilson. ⚡🙇 |
Rmkasun
reviewed
Oct 4, 2020
Rmkasun
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Submit general feedback
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Please be sure to read the contributor's guide to the GitHub package before submitting any pull requests.
Requirements
Description of the Change
Our
PullRequestPatchContainercomponent fetches and parses diffs from GitHub's REST API, then makes this available to child components as a MultiFilePatch. Unfortunately, it seems that pull requests with many or large files -- such as atom/flight-manual.atom.io#541 -- can cause stalls of a full minute (😱) while these are being parsed.Interestingly, the stalls seem to be in what-the-diff's PEG parser rather than our own
buildMultiFilePatch()function; in the past,buildMultiFilePatch()was the bottleneck. As a consequence our "large diff detection" logic isn't helping.To mitigate this:
CommentDecorationsContainerif the current PR has no review comments. Let's find review comments first and bail if there are none (which is the common case anyway).PullRequestDetailViewcan gracefully handle a missing diff. Or at least not crash horribly.Screenshot/Gif
Here's what I'm doing if you open an editor on a file that has review comments, but whose patch has been omitted for size:
Alternate Designs
N/A
Benefits
Using Atom to edit files on branches corresponding to pull requests with "large" diffs will no longer cause periodic stalls.
Possible Drawbacks
The review comment and patch fetches can happen in parallel presently because they're independent operations. By making the patch fetch depend on the result of the review comment aggregation, it'll take longer to load all of the data and display the first review comment decoration or populate the reviews tab.
Applicable Issues
N/A
Metrics
N/A
Tests
Documentation
N/A
Release Notes
User Experience Research (Optional)
N/A