Merge pull request #6109 from timchenxiaoyu/githubdev

fix #6054  MaxConcurrentDownloads is not effect when Unpack is true
This commit is contained in:
Derek McGowan 2021-10-19 13:50:35 -07:00 committed by GitHub
commit f44d4cf8ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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
}