Browse code

Increase ping timeout

Ensure v2 registries are given more than 5 seconds to return a ping and avoid an unnecessary fallback to v1.
Elevates log level about failed v2 ping to a warning to match the warning related to using v1 registries.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)

Derek McGowan authored on 2015/10/17 07:34:35
Showing 2 changed files
... ...
@@ -37,7 +37,7 @@ func (p *v2Puller) Pull(tag string) (fallback bool, err error) {
37 37
 	// TODO(tiborvass): was ReceiveTimeout
38 38
 	p.repo, err = NewV2Repository(p.repoInfo, p.endpoint, p.config.MetaHeaders, p.config.AuthConfig, "pull")
39 39
 	if err != nil {
40
-		logrus.Debugf("Error getting v2 registry: %v", err)
40
+		logrus.Warnf("Error getting v2 registry: %v", err)
41 41
 		return true, err
42 42
 	}
43 43
 
... ...
@@ -57,7 +57,7 @@ func NewV2Repository(repoInfo *registry.RepositoryInfo, endpoint registry.APIEnd
57 57
 	authTransport := transport.NewTransport(base, modifiers...)
58 58
 	pingClient := &http.Client{
59 59
 		Transport: authTransport,
60
-		Timeout:   5 * time.Second,
60
+		Timeout:   15 * time.Second,
61 61
 	}
62 62
 	endpointStr := endpoint.URL + "/v2/"
63 63
 	req, err := http.NewRequest("GET", endpointStr, nil)