MCPcopy
hub / github.com/dgraph-io/dgraph / RetryMutation

Function RetryMutation

testutil/client.go:432–445  ·  view source on GitHub ↗

RetryMutation will retry a mutation until it succeeds or a non-retryable error is received. The mutation should have CommitNow set to true.

(dg *dgo.Dgraph, mu *api.Mutation)

Source from the content-addressed store, hash-verified

430// RetryMutation will retry a mutation until it succeeds or a non-retryable error is received.
431// The mutation should have CommitNow set to true.
432func RetryMutation(dg *dgo.Dgraph, mu *api.Mutation) error {
433 for {
434 _, err := dg.NewTxn().Mutate(context.Background(), mu)
435 if err != nil && (strings.Contains(err.Error(), "Please retry") ||
436 strings.Contains(err.Error(), "Tablet isn't being served by this instance") ||
437 strings.Contains(err.Error(), "connection closed")) {
438 // Retry connection issues because some tests (e.g TestSnapshot) are stopping and
439 // starting alphas.
440 time.Sleep(10 * time.Millisecond)
441 continue
442 }
443 return err
444 }
445}
446
447// LoginParams stores the information needed to perform a login request.
448type LoginParams struct {

Callers 10

addBankDataFunction · 0.92
TestReverseIndexFunction · 0.92
TestStringIndexFunction · 0.92
TestCountIndexFunction · 0.92
setClusterEdgeFunction · 0.92
delClusterEdgeFunction · 0.92
setClusterEdgeFunction · 0.92
delClusterEdgeFunction · 0.92
BenchmarkEqFilterFunction · 0.92
TestSnapshotFunction · 0.92

Calls 2

MutateMethod · 0.65
ErrorMethod · 0.45

Tested by 10

addBankDataFunction · 0.74
TestReverseIndexFunction · 0.74
TestStringIndexFunction · 0.74
TestCountIndexFunction · 0.74
setClusterEdgeFunction · 0.74
delClusterEdgeFunction · 0.74
setClusterEdgeFunction · 0.74
delClusterEdgeFunction · 0.74
BenchmarkEqFilterFunction · 0.74
TestSnapshotFunction · 0.74