Use read deadline for registry server read#30
Merged
Conversation
alexcb
reviewed
Oct 23, 2023
| if err != nil { | ||
| return 0, err | ||
| } | ||
| buf := make([]byte, 32*1024) |
Contributor
There was a problem hiding this comment.
can we move this outside of the for loop? reallocating this buffer each time might be expensive.
alexcb
reviewed
Oct 23, 2023
alexcb
reviewed
Oct 25, 2023
| } | ||
| return t, err | ||
| } | ||
| buf = buf[0:n] |
Contributor
There was a problem hiding this comment.
This seems problematic, because this will shrink the buf, and the next time conn.Read(buf) is called, it could be smaller.
Maybe it's best to delete this line, and do w.Write(buf[0:n]) instead?
Contributor
Author
There was a problem hiding this comment.
Thanks. I missed that line when I made the previous change. Updated.
alexcb
approved these changes
Oct 25, 2023
1f0bbc6 to
d5e9d25
Compare
mikejholly
added a commit
to earthly/earthly
that referenced
this pull request
Oct 26, 2023
Enables image registry proxy support for Mac via a side-car `socat` container. On Mac, `docker pull` (and friends) will make requests to `localhost`. These requests will be answered by the `socat` container and proxied through to the registry proxy server spawned by the CLI. That server then sends the request to BK (remote or local) via the gRPC tunnel. Depends on: earthly/buildkit#30 #3412
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.
For the registry-over-gRPC proxy, we'll also want to timeout idle reads from the BK registry server so as not to leave connections open. Discovered while testing earthly/earthly#3420.