Skip to content

Commit

Permalink
chore: change S3 DeleteObjects parallels count (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
go-to-k authored Aug 18, 2023
1 parent 472cf3a commit 1ff4434
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions pkg/client/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package client

import (
"context"
"runtime"
"strings"
"sync"

Expand Down Expand Up @@ -70,15 +69,9 @@ func (s *S3) DeleteObjects(ctx context.Context, bucketName *string, objects []ty
return errors, nil
}

maxParallelsCount := MaxS3DeleteObjectsParallelsCount
numCPU := runtime.NumCPU()
if numCPU < MaxS3DeleteObjectsParallelsCount {
maxParallelsCount = numCPU
}

eg, ctx := errgroup.WithContext(ctx)
outputsCh := make(chan *s3.DeleteObjectsOutput, maxParallelsCount)
sem := semaphore.NewWeighted(int64(maxParallelsCount))
outputsCh := make(chan *s3.DeleteObjectsOutput, MaxS3DeleteObjectsParallelsCount)
sem := semaphore.NewWeighted(int64(MaxS3DeleteObjectsParallelsCount))
wg := sync.WaitGroup{}

nextObjects := make([]types.ObjectIdentifier, len(objects))
Expand Down

0 comments on commit 1ff4434

Please sign in to comment.