Skip to content

Commit

Permalink
chore: wait longer for login to work (#8816)
Browse files Browse the repository at this point in the history
Seems like it takes longer for a 6 alpha cluster to be available
for running queries. This PR also makes the WaitForRestore
function more robust. It is possible that we try to get alpha's
health while it is in draining mode and we need to keep retrying
until it is ready to server again.
  • Loading branch information
mangalaman93 committed May 5, 2023
1 parent b3e0c72 commit a4913c2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion dgraphtest/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,9 @@ loop:
time.Sleep(waitDurBeforeRetry)

resp, err := c.AlphasHealth()
if err != nil {
if err != nil && strings.Contains(err.Error(), "the server is in draining mode") {
continue loop
} else if err != nil {
return err
}
for _, hr := range resp {
Expand Down
2 changes: 1 addition & 1 deletion dgraphtest/local_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ func (c *LocalCluster) containerHealthCheck(url string) error {

ctx, cancel := context.WithTimeout(context.Background(), requestTimeout)
defer cancel()
for i := 0; i < 3; i++ {
for i := 0; i < 10; i++ {
if err = client.Login(ctx, DefaultUser, DefaultPassword); err == nil {
break
}
Expand Down

0 comments on commit a4913c2

Please sign in to comment.