New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Continue retry connecting to zero instead of panicking #2307

Merged
merged 1 commit into from Apr 4, 2018
Jump to file or symbol
Failed to load files and symbols.
+5 −2
Diff settings

Always

Just for now

View
@@ -93,15 +93,18 @@ func StartRaftNodes(walStore *badger.ManagedDB, bindall bool) {
var connState *intern.ConnectionState
m := &intern.Member{Id: Config.RaftId, Addr: Config.MyAddr}
delay := 50 * time.Millisecond
for i := 0; i < 9; i++ { // Generous number of attempts.
maxHalfDelay := 15 * time.Second
for { // Keep on retrying. See: https://github.com/dgraph-io/dgraph/issues/2289
var err error
connState, err = zc.Connect(gr.ctx, m)
if err == nil {
break
}
x.Printf("Error while connecting with group zero: %v", err)
time.Sleep(delay)
delay *= 2
if delay <= maxHalfDelay {
delay *= 2
}
}
if connState.GetMember() == nil || connState.GetState() == nil {
x.Fatalf("Unable to join cluster via dgraphzero")
ProTip! Use n and p to navigate between commits in a pull request.