Skip to content

Commit affd710

Browse files
author
Stephen Asbury
committed
Don't timeout waiting for acks in rep only mode
1 parent c371a96 commit affd710

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

performance/stan_stan_bench/main.go

+16-11
Original file line numberDiff line numberDiff line change
@@ -331,18 +331,23 @@ func main() {
331331
}
332332

333333
if !direct {
334-
log.Printf("Waiting for acks to return to replicator before we shut it down")
335-
go func() {
336-
stop := time.Now().Add(10 * time.Second)
337-
ticker := time.NewTicker(500 * time.Millisecond)
338-
for t := range ticker.C {
339-
if t.After(stop) {
340-
repTimeout <- true
341-
break
334+
335+
if !repOnly {
336+
log.Printf("Waiting for acks to return to replicator before we shut it down, timeout of %d seconds", 10)
337+
go func() {
338+
stop := time.Now().Add(10 * time.Second)
339+
ticker := time.NewTicker(500 * time.Millisecond)
340+
for t := range ticker.C {
341+
if t.After(stop) {
342+
repTimeout <- true
343+
break
344+
}
342345
}
343-
}
344-
ticker.Stop()
345-
}()
346+
ticker.Stop()
347+
}()
348+
} else {
349+
log.Printf("Waiting for acks to replicator without timeout")
350+
}
346351

347352
repwg.Wait()
348353

0 commit comments

Comments
 (0)