diff --git a/vendor/github.com/hashicorp/go-checkpoint/checkpoint.go b/vendor/github.com/hashicorp/go-checkpoint/checkpoint.go index 4695bd9c2..36e572999 100644 --- a/vendor/github.com/hashicorp/go-checkpoint/checkpoint.go +++ b/vendor/github.com/hashicorp/go-checkpoint/checkpoint.go @@ -18,6 +18,7 @@ import ( "path/filepath" "reflect" "runtime" + "strconv" "strings" "time" @@ -204,6 +205,12 @@ func Check(p *CheckParams) (*CheckResponse, error) { return &CheckResponse{}, nil } + // set a default timeout of 3 sec for the check request (in milliseconds) + timeout := 3000 + if _, err := strconv.Atoi(os.Getenv("CHECKPOINT_TIMEOUT")); err == nil { + timeout, _ = strconv.Atoi(os.Getenv("CHECKPOINT_TIMEOUT")) + } + // If we have a cached result, then use that if r, err := checkCache(p.Version, p.CacheFile, p.CacheDuration); err != nil { return nil, err @@ -250,6 +257,11 @@ func Check(p *CheckParams) (*CheckResponse, error) { req.Header.Add("User-Agent", "HashiCorp/go-checkpoint") client := cleanhttp.DefaultClient() + + // We use a short timeout since checking for new versions is not critical + // enough to block on if checkpoint is broken/slow. + client.Timeout = time.Duration(timeout) * time.Millisecond + resp, err := client.Do(req) if err != nil { return nil, err diff --git a/vendor/vendor.json b/vendor/vendor.json index 9f046eeb9..f9b17b648 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -769,10 +769,10 @@ "revision": "7554cd9344cec97297fa6649b055a8c98c2a1e55" }, { - "checksumSHA1": "vnuMNXv3FJSg/I8ig04OTEHjk1c=", + "checksumSHA1": "D267IUMW2rcb+vNe3QU+xhfSrgY=", "path": "github.com/hashicorp/go-checkpoint", - "revision": "a8d0786e7fa88adb6b3bcaa341a99af7f9740671", - "revisionTime": "2017-06-24T02:34:07Z" + "revision": "1545e56e46dec3bba264e41fde2c1e2aa65b5dd4", + "revisionTime": "2017-10-09T17:35:28Z" }, { "checksumSHA1": "fSe5y1UgTDeYlnFfUcDA1zzcw+U=",