Merge pull request #3653 from lalyos/fix-connect-timeout

implement ctr --connect-timeout
This commit is contained in:
Phil Estes 2019-09-16 10:52:03 -04:00 committed by GitHub
commit 86442dfbb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -47,6 +47,8 @@ func AppContext(context *cli.Context) (gocontext.Context, gocontext.CancelFunc)
// NewClient returns a new containerd client // NewClient returns a new containerd client
func NewClient(context *cli.Context, opts ...containerd.ClientOpt) (*containerd.Client, gocontext.Context, gocontext.CancelFunc, error) { func NewClient(context *cli.Context, opts ...containerd.ClientOpt) (*containerd.Client, gocontext.Context, gocontext.CancelFunc, error) {
timeoutOpt := containerd.WithTimeout(context.GlobalDuration("connect-timeout"))
opts = append(opts, timeoutOpt)
client, err := containerd.New(context.GlobalString("address"), opts...) client, err := containerd.New(context.GlobalString("address"), opts...)
if err != nil { if err != nil {
return nil, nil, nil, err return nil, nil, nil, err