Skip to content

Commit

Permalink
Add retry to getRemoteInfo
Browse files Browse the repository at this point in the history
Signed-off-by: Yilun <[email protected]>
  • Loading branch information
yilunzhang committed Mar 30, 2023
1 parent 81e874b commit 43aa785
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,16 @@ func main() {
if err != nil {
return nil, err
}
remoteInfoCache, err = c.GetInfo(opts.RemoteAdminAddr)
for retry := 0; retry < 3; retry++ {
remoteInfoCache, err = c.GetInfo(opts.RemoteAdminAddr)
if err != nil {
log.Printf("Get remote server info error: %v", err)
continue
}
break
}
if err != nil {
return nil, fmt.Errorf("Get remote server info error: %v. Please make sure server is online and accepting connections from this client address", err)
return nil, fmt.Errorf("failed to get remote server info, please make sure server is online and accepting connections from this client address")
}
return remoteInfoCache, nil
}
Expand Down

0 comments on commit 43aa785

Please sign in to comment.