File: utils.go

package info (click to toggle)
golang-github-rancher-go-rancher-metadata 0.0~git20200311.7f4c936-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 116 kB
  • sloc: makefile: 4
file content (19 lines) | stat: -rw-r--r-- 305 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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
}