fix #6054 MaxConcurrentDownloads is not effect when Unpack is true

Signed-off-by: weixian.cxy <weixian.cxy@alibaba-inc.com>
This commit is contained in:
weixian.cxy 2021-10-09 14:39:25 +08:00
parent a4663097ec
commit 535191abf3

View File

@ -65,11 +65,16 @@ func (c *Client) newUnpacker(ctx context.Context, rCtx *RemoteContext) (*unpacke
return nil, err
}
}
var limiter *semaphore.Weighted
if rCtx.MaxConcurrentDownloads > 0 {
limiter = semaphore.NewWeighted(int64(rCtx.MaxConcurrentDownloads))
}
return &unpacker{
updateCh: make(chan ocispec.Descriptor, 128),
snapshotter: snapshotter,
config: config,
c: c,
limiter: limiter,
}, nil
}