From 49f1a26209085b5d1fef7b817f64e53ca7441cec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=20Wei=20=28=E4=BB=BB=E5=8D=AB=29?= Date: Tue, 26 May 2020 16:40:10 +0800 Subject: [PATCH] SetTimeout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/heroku/docker-registry-client/issues/31 较好的方法应该是这个支持context --- registry/registry.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/registry/registry.go b/registry/registry.go index 17c480a5..ac7a77db 100644 --- a/registry/registry.go +++ b/registry/registry.go @@ -6,6 +6,7 @@ import ( "log" "net/http" "strings" + "time" ) type LogfCallback func(format string, args ...interface{}) @@ -118,3 +119,8 @@ func (r *Registry) Ping() error { } return err } + +func (r *Registry) SetTimeout(duration time.Duration) { + r.Client.Timeout = duration +} +