This repository has been archived by the owner on Jun 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 673
Wait until ready; make test 810 more reliable #2946
Merged
Merged
Conversation
This file contains 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
This way it is more likely that we create it after the plugin is up and running.
marccarre
reviewed
May 11, 2017
// It would be better if we could delay calling Done() until all | ||
// the listeners are ready, but it doesn't seem to be possible to | ||
// hook the right point in http.Server | ||
ready() | ||
for range listeners { | ||
err := <-errs | ||
if err != nil { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
marccarre
reviewed
May 11, 2017
errs := make(chan error) | ||
for _, listener := range listeners { | ||
go func(listener net.Listener) { | ||
errs <- (&http.Server{Handler: proxy}).Serve(listener) | ||
}(listener) | ||
} | ||
// It would be better if we could delay calling Done() until all | ||
// the listeners are ready, but it doesn't seem to be possible to | ||
// hook the right point in http.Server |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
marccarre
approved these changes
May 11, 2017
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.
brb
reviewed
May 12, 2017
@@ -54,6 +54,13 @@ func run(dockerClient *docker.Client, weave *weaveapi.Client, address, meshAddre | |||
defer os.Remove(meshAddress) | |||
defer meshListener.Close() | |||
} | |||
if !isPluginV2 { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
5 tasks
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Various parts of the system initialize asynchronously at startup.
Callers should not attempt operations until all parts are ready; the
weave
script already delays untilcurl /status
returns 200, but this could happen too early.So, we introduce a
ready
function to be called by each sub-part: plugin, proxy, expose; this function comes from a wrappedWaitGroup
.We don't actually wait on the
WaitGroup
; that could perhaps be simplified, but I thought it was a good idea to follow the pattern.