Tweak comments

This commit is contained in:
Mark Haines 2017-07-18 12:01:28 +01:00
parent 4eec8da6b5
commit 90dbaf94be

View file

@ -141,8 +141,8 @@ func runAndReadFromTopic(runCmd *exec.Cmd, readyURL string, doInput func(), topi
done <- result{nil, fmt.Errorf("Timeout reading %d messages from topic %q", count, topic)} done <- result{nil, fmt.Errorf("Timeout reading %d messages from topic %q", count, topic)}
}() }()
// Poll the HTTP listener of the process waiting for it to be ready to receive requests.
ready := make(chan struct{}) ready := make(chan struct{})
go func() { go func() {
delay := 10 * time.Millisecond delay := 10 * time.Millisecond
for { for {
@ -150,7 +150,6 @@ func runAndReadFromTopic(runCmd *exec.Cmd, readyURL string, doInput func(), topi
if delay < 100*time.Millisecond { if delay < 100*time.Millisecond {
delay *= 2 delay *= 2
} }
fmt.Printf("Checking %s\n", readyURL)
resp, err := http.Get(readyURL) resp, err := http.Get(readyURL)
if err != nil { if err != nil {
continue continue
@ -162,8 +161,7 @@ func runAndReadFromTopic(runCmd *exec.Cmd, readyURL string, doInput func(), topi
ready <- struct{}{} ready <- struct{}{}
}() }()
// Wait for the roomserver to either be read to receive input or for it to // Wait for the roomserver to be ready to receive input or for it to crash.
// crash.
select { select {
case <-ready: case <-ready:
case r := <-done: case r := <-done:
@ -239,6 +237,7 @@ func testRoomserver(input []string, wantOutput []string, checkQueries func(api.R
} }
doInput := func() { doInput := func() {
fmt.Printf("Roomserver is ready to receive input, sending %d events\n", len(input))
if err = writeToRoomServer(input, cfg.RoomServerURL()); err != nil { if err = writeToRoomServer(input, cfg.RoomServerURL()); err != nil {
panic(err) panic(err)
} }