Skip to content

Commit

Permalink
add retry for schema update (#5924)
Browse files Browse the repository at this point in the history
Signed-off-by: Tiger <[email protected]>
  • Loading branch information
poonai authored and பாலாஜி committed Jul 28, 2020
1 parent 2764f61 commit c529516
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions query/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,17 @@ import (
)

func setSchema(schema string) {
err := client.Alter(context.Background(), &api.Operation{
Schema: schema,
})
if err != nil {
panic(fmt.Sprintf("Could not alter schema. Got error %v", err.Error()))
for retry := 0; retry < 3; retry++ {
err := client.Alter(context.Background(), &api.Operation{
Schema: schema,
})
if err == nil {
return
}
// We'll panic if we are in last iteration.
if retry == 2 {
panic(fmt.Sprintf("Could not alter schema. Got error %v", err.Error()))
}
}
}

Expand Down

0 comments on commit c529516

Please sign in to comment.