mirror of
https://github.com/golang/go
synced 2024-11-18 08:34:44 -07:00
cmd/godoc: move poll sleep to top of loop
CL 196979 moved the pollInterval sleep to the bottom of the loop with the intent of not sleeping before the first readiness check, but that caused an unintended consequence of the sleep being skipped when errors happen. Move it back to the top to avoid that problem. Change-Id: Ia63f09afe47d93df657ca867ceecc4d7df6abccc Reviewed-on: https://go-review.googlesource.com/c/tools/+/197940 Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
e7abfedfab
commit
90aeebe843
@ -126,6 +126,7 @@ const pollInterval = 200 * time.Millisecond
|
||||
func waitForServer(t *testing.T, ch chan<- error, url, match string, timeout time.Duration, reverse bool) {
|
||||
deadline := time.Now().Add(timeout)
|
||||
for time.Now().Before(deadline) {
|
||||
time.Sleep(pollInterval)
|
||||
if t.Failed() {
|
||||
return
|
||||
}
|
||||
@ -144,7 +145,6 @@ func waitForServer(t *testing.T, ch chan<- error, url, match string, timeout tim
|
||||
ch <- nil
|
||||
return
|
||||
}
|
||||
time.Sleep(pollInterval)
|
||||
}
|
||||
ch <- fmt.Errorf("server failed to respond in %v", timeout)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user