-
Notifications
You must be signed in to change notification settings - Fork 749
Default GitHubConnectorResponse to streamed body instead of in-memory buffer #2059
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default GitHubConnectorResponse to streamed body instead of in-memory buffer #2059
Conversation
context: hub4j#1405 GHArtifact.download() now explicitly sets this option to make response stream non-buffered.
@atsushieno |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2059 +/- ##
============================================
+ Coverage 83.58% 83.69% +0.10%
- Complexity 2380 2394 +14
============================================
Files 235 235
Lines 7262 7278 +16
Branches 382 386 +4
============================================
+ Hits 6070 6091 +21
+ Misses 956 954 -2
+ Partials 236 233 -3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
218b1e7
to
b2641c0
Compare
@atsushieno I made some tweaks to the code to get coverage and handle some edge cases. Then moved the unbuffered setting down to Then added a fallback so buffering is avoided only when status code is HTTP_OK (200). Looking at this, it seems like the only case where we need buffering is for multiple reads of the body stream, which only occur in error, finest logging, and debugging scenarios. I think it could be possible to moved to having unbuffered response streaming be the default for all calls when status == 200 and specifically
Maybe with a static variable that allows forcing buffering for debugging. I don't expect you to do any of the above. I'm thinking out loud and trying to decide if it's worth trying. |
@bitwiseman Thanks a lot to make this changeset way more solid. I saw a bunch of changes and the set of further changes seems in the right direction to me. |
ecd30c8
to
9a18e00
Compare
@atsushieno |
9a18e00
to
53be1b3
Compare
I noticed that, that would be even better if everything works! |
e411991
to
bf53879
Compare
bf53879
to
89c2efc
Compare
Default GitHubConnectorResponse to streamed body instead of in-memory buffer.
This significantly reduces memory usage especially for large responses such as
GhArtifact.download()
.GitHubConnectorResponse
automatically falls back to buffered where required.Fixes: #1405
Description
Before submitting a PR:
@link
JavaDoc entries to the relevant documentation on https://docs.github.com/en/rest .mvn -D enable-ci clean install site
locally. If this command doesn't succeed, your change will not pass CI.main
. You will create your PR from that branch.When creating a PR: