Uh oh!
There was an error while loading. Please reload this page.
[19.03 backport] cli: perform feature detection lazily - #2457
Merged
silvin-lubecki merged 3 commits intoApr 30, 2020
Merged
Conversation
thaJeztahforce-pushed
the
19.03_backport_lazy_feature_detection
branch
2 times, most recently
from
April 21, 2020 15:19
906feb7 to
c079435CompareSigned-off-by: Anca Iordache <anca.iordache@docker.com> Possible approach for client info - split ClientInfo() into ClientInfo() and loadClientInfo() - split ConfigFile() into ConfigFile() and loadConfigFile() - ConfigFile() and ClientInfo() call their corresponding loadXX function if it has not yet been loaded; this allows them to be used before Initialize() was called. - Initialize() *always* (re-)loads the configuration; this makes sure that the correct configuration is used when actually calling commands. Signed-off-by: Sebastiaan van Stijn <github@gone.nl> (cherry picked from commit 22a5dad) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl> (cherry picked from commit a88a1be) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
- Perform feature detection when actually needed, instead of during initializing - Version negotiation is performed either when making an API request, or when (e.g.) running `docker help` (to hide unsupported features) - Use a 2 second timeout when 'pinging' the daemon; this should be sufficient for most cases, and when feature detection failed, the daemon will still perform validation (and produce an error if needed) - context.WithTimeout doesn't currently work with ssh connections (connhelper), so we're only applying this timeout for tcp:// connections, otherwise keep the old behavior. Before this change: time sh -c 'DOCKER_HOST=tcp://42.42.42.41:4242 docker help &> /dev/null' real 0m32.919s user 0m0.370s sys 0m0.227s time sh -c 'DOCKER_HOST=tcp://42.42.42.41:4242 docker context ls &> /dev/null' real 0m32.072s user 0m0.029s sys 0m0.023s After this change: time sh -c 'DOCKER_HOST=tcp://42.42.42.41:4242 docker help &> /dev/null' real 0m 2.28s user 0m 0.03s sys 0m 0.03s time sh -c 'DOCKER_HOST=tcp://42.42.42.41:4242 docker context ls &> /dev/null' real 0m 0.13s user 0m 0.02s sys 0m 0.02s Signed-off-by: Sebastiaan van Stijn <github@gone.nl> (cherry picked from commit b397391) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
thaJeztahforce-pushed
the
19.03_backport_lazy_feature_detection
branch
from
April 29, 2020 15:13
c079435 to
cf663b5ComparethaJeztah
marked this pull request as ready for review
April 29, 2020 15:13
| func (cli *DockerCli) ClientInfo() ClientInfo { | ||
| return cli.clientInfo | ||
| if cli.clientInfo == nil { | ||
| _ = cli.loadClientInfo() |
Collaborator
There was a problem hiding this comment.
find this a bit weird but oh well
MemberAuthor
There was a problem hiding this comment.
the _ = you mean?
mostly to satisfy linters from possibly warning "you didn't check the error!"
tiborvass
approved these changes
Apr 30, 2020
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 freeto 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.
based on top of #2456
backports of: