-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
HttpCacheClient: make upload async #12115
Conversation
This matches the behavior for download, and improves performance for actions with a lot of large outputs. The code was already using futures in the API and in the implementation, but the glue code blocked on the internal future and returned an immediate future to the caller, rather than doing it async. Fixes bazelbuild#6091. Change-Id: I3151aa96b879323e0000d3209f6b9bc8be0066d4
Thanks for the PR! LGTM. But some tests failed, any idea with that? |
It was a bug in the change which I just fixed. |
All tests pass! |
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.
Some minor nits
|
||
try { | ||
Channel ch = channelAcquired.getNow(); | ||
ChannelPipeline p = ch.pipeline(); |
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.
nit: can you please change p
to pipeline
(or similar)?
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.
Fixed. I changed the download side as well.
SettableFuture<Void> result = SettableFuture.create(); | ||
acquireUploadChannel() | ||
.addListener( | ||
(Future<Channel> chP) -> { |
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.
nit: channelPromise
?
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.
Changed. I didn't change the download side.
uploadBlocking(digest.getHash(), digest.getSizeBytes(), in, /* casUpload= */ true); | ||
} catch (IOException | InterruptedException e) { | ||
try { | ||
return uploadAsync(digest.getHash(), digest.getSizeBytes(), file.getInputStream(), true); |
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.
nit: please re-add /* casUpload= */
(same a few lines below and line 695)
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.
Sorry about that. Not sure how that got lost.
if (cause instanceof HttpException) { | ||
HttpResponse response = ((HttpException) cause).response(); | ||
try { | ||
// If the error is due to an expired auth token and we can reset the input stream, |
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.
nit: line too long
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.
Fixed. Also a couple more of these.
PTAL |
This matches the behavior for download, and improves performance for actions with a lot of outputs. The code was already using futures in the API and in the implementation, but the glue code blocked on the internal future and returned an immediate future to the caller, rather than doing it async. Fixes bazelbuild#6091. Change-Id: I3151aa96b879323e0000d3209f6b9bc8be0066d4 Closes bazelbuild#12115. Change-Id: I72032f7b3e88de4d2e2b5abd2d89380f7fcc31e5 PiperOrigin-RevId: 332796965
This matches the behavior for download, and improves performance for actions
with a lot of outputs.
The code was already using futures in the API and in the implementation,
but the glue code blocked on the internal future and returned an immediate
future to the caller, rather than doing it async.
Fixes #6091.
Change-Id: I3151aa96b879323e0000d3209f6b9bc8be0066d4