Skip to content
Snippets Groups Projects
Unverified Commit d5ef2b67 authored by Peter Stace's avatar Peter Stace Committed by GitHub
Browse files

Bulk loader retries when obtaining write ts from zero (#1858)

* Retry when getting write ts from zero

* Fix print format
parent e993dcc3
No related branches found
No related tags found
No related merge requests found
...@@ -109,11 +109,16 @@ func newLoader(opt options) *loader { ...@@ -109,11 +109,16 @@ func newLoader(opt options) *loader {
} }
func getWriteTimestamp(zero intern.ZeroClient) uint64 { func getWriteTimestamp(zero intern.ZeroClient) uint64 {
ctx, cancel := context.WithTimeout(context.Background(), time.Second) for {
defer cancel() ctx, cancel := context.WithTimeout(context.Background(), time.Second)
ts, err := zero.Timestamps(ctx, &intern.Num{Val: 1}) ts, err := zero.Timestamps(ctx, &intern.Num{Val: 1})
x.Check(x.Wrapf(err, "error communicating with dgraphzero, is it running?")) cancel()
return ts.GetStartId() if err == nil {
return ts.GetStartId()
}
x.Printf("error communicating with dgraph zero, retrying: %v", err)
time.Sleep(time.Second)
}
} }
func readSchema(filename string) []*intern.SchemaUpdate { func readSchema(filename string) []*intern.SchemaUpdate {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment