Don't return OK from status until all parts are ready

This commit is contained in:
Bryan Boreham committed 2017-05-11 14:02:45 +00:00
1 parent 3e0eb4ac1e
commit 7611cd963c
6 files changed
+57 -15

No files matched your search

+5 -1
View File
@@ -280,13 +280,17 @@ func (proxy *Proxy) Listen() []net.Listener {
return listeners
}
func (proxy *Proxy) Serve(listeners []net.Listener) {
func (proxy *Proxy) Serve(listeners []net.Listener, ready func()) {
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
ready()
for range listeners {
err := <-errs
if err != nil {