traefik/vendor/github.com/rancher/go-rancher-metadata/metadata/utils.go

20 lines
305 B
Go
Raw Normal View History

2019-04-05 10:22:04 +00:00
package metadata
import (
"time"
)
func testConnection(mdClient Client) error {
var err error
maxTime := 20 * time.Second
for i := 1 * time.Second; i < maxTime; i *= time.Duration(2) {
if _, err = mdClient.GetVersion(); err != nil {
time.Sleep(i)
} else {
return nil
}
}
return err
}