Skip to content

Continue retry connecting to zero instead of panicking #2307

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

Merged
merged 1 commit into from
Apr 4, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions worker/groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down