-
Notifications
You must be signed in to change notification settings - Fork 503
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
Refactor builder and drivers info logic #1430
Conversation
8930e23
to
d3a0a07
Compare
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.
I like the refactor 🎉 - left a couple comments.
I'm curious, I can't quite see where the performance improvement has come from 👀
This comment was marked as resolved.
This comment was marked as resolved.
d3a0a07
to
94e1113
Compare
e4df400
to
1062c23
Compare
1062c23
to
24b093a
Compare
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.
LGTM, just a minor function rename :)
build/build.go
Outdated
|
||
func filterAvailableDrivers(drivers []DriverInfo) ([]DriverInfo, error) { | ||
out := make([]DriverInfo, 0, len(drivers)) | ||
func filterAvailableDrivers(nodes []builder.Node) ([]builder.Node, error) { |
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.
func filterAvailableDrivers(nodes []builder.Node) ([]builder.Node, error) { | |
func filterAvailableNodes(nodes []builder.Node) ([]builder.Node, error) { |
Signed-off-by: CrazyMax <[email protected]>
Signed-off-by: CrazyMax <[email protected]>
Signed-off-by: CrazyMax <[email protected]>
24b093a
to
cc01caa
Compare
func(i int, n store.Node) { | ||
eg.Go(func() error { |
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.
The code would be easier to read if at least one of these annonymous function was tunred into a mehtod.
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.
Yes agree, I put a comment on this method so we can track this as follow-up: https://github.com/docker/buildx/pull/1430/files#diff-7c6ac5bb2a9c2322f716d7b66113042e64298fbdc5cba600abed692a0c2a6570R38
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.
Thanks a lot, this is a significant improvement! I might follow up with a few more things, as I'm trying to use some of the same functions in another project.
if b.err == nil && err != nil { | ||
b.err = err | ||
} | ||
_, _ = b.LoadNodes(timeoutCtx, 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.
Why is this ignoring the error instead of setting it to the builder?
Moves builder and drivers info logic from
commands
pkg to a dedicated client pkg so we can easily interact with builders and drivers. Refactoring reduced latency for operations when loading drivers data or checking already validated endpoints:Added some TODOs as there is still room for improvements.