Use a stream when uploading database contents#1465
Merged
robertbrignull merged 3 commits intomainfrom Jan 9, 2023
Merged
Conversation
Contributor
Author
|
I tested this in another repo and the database upload was successful. |
Contributor
|
Hm, looks like there's a genuine unit test failure related to the Windows file system 👁️ |
Contributor
|
Looks reasonable to me. @angelapwen is right. I wonder if you need to explicitly close the read stream before you can delete it. |
Comment on lines
+50
to
+61
| { | ||
| owner: repositoryNwo.owner, | ||
| repo: repositoryNwo.repo, | ||
| language, | ||
| name: `${language}-database`, | ||
| data: bundledDbReadStream, | ||
| headers: { | ||
| authorization: `token ${apiDetails.auth}`, | ||
| "Content-Type": "application/zip", | ||
| "Content-Length": bundledDbSize, | ||
| }, | ||
| } |
Check warning
Code scanning / CodeQL
File data in outbound network request
Contributor
Author
There was a problem hiding this comment.
This is intended and not changing behaviour in this PR
Contributor
Author
|
Thanks @angelapwen and @aeisenberg. I've added a |
elenatanasoiu
approved these changes
Jan 9, 2023
This was referenced Jan 12, 2023
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.
Closes #1383
Instead of loading the entire database contents into memory, pass a
ReadStreamtorequest. Internally, octokit usesnode-fetchand that is capable of accepting a stream. I then had to add the content length manually because the database upload API requires this header, but it wasn't populated when passing a stream torequest.Finally, I moved slightly more logic inside the try-catch. This should mean that if the database upload fails again for a user it won't block the main analysis and generally won't be an issue.
Merge / deployment checklist