Merge pull request #8466 from dmcgowan/fix-transfer-default-limiters
[transfer] avoid setting limiters when max is 0
This commit is contained in:
commit
be2ca3c860
@ -46,14 +46,19 @@ type localTransferService struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewTransferService(lm leases.Manager, cs content.Store, is images.Store, tc *TransferConfig) transfer.Transferrer {
|
func NewTransferService(lm leases.Manager, cs content.Store, is images.Store, tc *TransferConfig) transfer.Transferrer {
|
||||||
return &localTransferService{
|
ts := &localTransferService{
|
||||||
leases: lm,
|
leases: lm,
|
||||||
content: cs,
|
content: cs,
|
||||||
images: is,
|
images: is,
|
||||||
limiterU: semaphore.NewWeighted(int64(tc.MaxConcurrentUploadedLayers)),
|
config: *tc,
|
||||||
limiterD: semaphore.NewWeighted(int64(tc.MaxConcurrentDownloads)),
|
|
||||||
config: *tc,
|
|
||||||
}
|
}
|
||||||
|
if tc.MaxConcurrentUploadedLayers > 0 {
|
||||||
|
ts.limiterU = semaphore.NewWeighted(int64(tc.MaxConcurrentUploadedLayers))
|
||||||
|
}
|
||||||
|
if tc.MaxConcurrentDownloads > 0 {
|
||||||
|
ts.limiterD = semaphore.NewWeighted(int64(tc.MaxConcurrentDownloads))
|
||||||
|
}
|
||||||
|
return ts
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ts *localTransferService) Transfer(ctx context.Context, src interface{}, dest interface{}, opts ...transfer.Opt) error {
|
func (ts *localTransferService) Transfer(ctx context.Context, src interface{}, dest interface{}, opts ...transfer.Opt) error {
|
||||||
|
Loading…
Reference in New Issue
Block a user