Skip to content

Commit c9437cd

Browse files
oktalzaiharos
authored andcommitted
BUG/MEDIUM: cluster: solve race condition on connecting on cold start
low GOMAXPROCS value can cause issue that notification about bootstrap key changed is issued before app is actually subscribed to that event. Therefore, it can miss notification and do nothing
1 parent 453d396 commit c9437cd

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

configuration/cluster_sync.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import (
3030
"net/http"
3131
"os"
3232
"path"
33+
"runtime"
3334
"strings"
3435
"time"
3536

@@ -82,6 +83,7 @@ func (c *ClusterSync) Monitor(cfg *Configuration, cli *client_native.HAProxyClie
8283
certFetched := cfg.Cluster.Certificate.Fetched.Load()
8384

8485
if key != "" && !certFetched {
86+
runtime.Gosched()
8587
c.cfg.Notify.BootstrapKeyChanged.Notify()
8688
}
8789
}

0 commit comments

Comments
 (0)