go: sqle: cluster: Only close successChs when we are actually caught up.

This commit is contained in:
Aaron Son
2023-05-15 13:58:14 -07:00
parent a886ab276a
commit 09eb9aaed5

View File

@@ -157,13 +157,13 @@ func (h *commithook) replicate(ctx context.Context) {
if h.waitNotify != nil {
h.waitNotify()
}
if len(h.successChs) != 0 {
if len(h.successChs) != 0 && h.isCaughtUp() {
for _, ch := range h.successChs {
close(ch)
}
h.successChs = nil
h.circuitBreakerOpen = false
}
h.circuitBreakerOpen = false
h.cond.Wait()
lgr.Tracef("cluster/commithook: background thread: woken up.")
}