From 3b0cd1bf65de128b09351d8a5fee592ef37eea9a Mon Sep 17 00:00:00 2001 From: Andrew Gerrand Date: Tue, 10 Mar 2015 12:13:37 +1100 Subject: [PATCH] cmd/tipgodoc: increase startup 'health check' deadline Also use a more reliable implementation. Change-Id: I9e6858c7e9bdb60f1fb4e060e6d4d1b3762b83bc Reviewed-on: https://go-review.googlesource.com/7260 Reviewed-by: Minux Ma --- cmd/tipgodoc/tip.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/tipgodoc/tip.go b/cmd/tipgodoc/tip.go index dbd7f1f3..e60bd644 100644 --- a/cmd/tipgodoc/tip.go +++ b/cmd/tipgodoc/tip.go @@ -25,8 +25,9 @@ import ( ) const ( - repoURL = "https://go.googlesource.com/" - metaURL = "https://go.googlesource.com/?b=master&format=JSON" + repoURL = "https://go.googlesource.com/" + metaURL = "https://go.googlesource.com/?b=master&format=JSON" + startTimeout = 5 * time.Minute ) var indexingMsg = []byte("Indexing in progress: result may be inaccurate") @@ -183,7 +184,8 @@ func initSide(side, goHash, toolsHash string) (godoc *exec.Cmd, hostport string, } }() - for i := 0; i < 120; i++ { + deadline := time.Now().Add(startTimeout) + for time.Now().Before(deadline) { time.Sleep(time.Second) var res *http.Response res, err = http.Get(fmt.Sprintf("http://%v/search?q=FALLTHROUGH", hostport))