From ba20f8284fe6baa6e12decf4e33cf8d2fa10df6b Mon Sep 17 00:00:00 2001 From: Yilun Date: Thu, 30 Mar 2023 03:51:22 -0700 Subject: [PATCH] Add retry to getRemoteInfo Signed-off-by: Yilun --- main.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 79a3330..88d320a 100644 --- a/main.go +++ b/main.go @@ -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 }