Skip to content

Commit 43aa785

Browse files
committed
Add retry to getRemoteInfo
Signed-off-by: Yilun <zyl.skysniper@gmail.com>
1 parent 81e874b commit 43aa785

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

main.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,9 +303,16 @@ func main() {
303303
if err != nil {
304304
return nil, err
305305
}
306-
remoteInfoCache, err = c.GetInfo(opts.RemoteAdminAddr)
306+
for retry := 0; retry < 3; retry++ {
307+
remoteInfoCache, err = c.GetInfo(opts.RemoteAdminAddr)
308+
if err != nil {
309+
log.Printf("Get remote server info error: %v", err)
310+
continue
311+
}
312+
break
313+
}
307314
if err != nil {
308-
return nil, fmt.Errorf("Get remote server info error: %v. Please make sure server is online and accepting connections from this client address", err)
315+
return nil, fmt.Errorf("failed to get remote server info, please make sure server is online and accepting connections from this client address")
309316
}
310317
return remoteInfoCache, nil
311318
}

0 commit comments

Comments
 (0)