-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gcsupload: limit maximum upload concurrency #16658
gcsupload: limit maximum upload concurrency #16658
Conversation
for dest, upload := range uploadTargets { | ||
log := logrus.WithField("dest", dest) | ||
if err := sem.Acquire(context.Background(), 1); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: it's actually the dtw(dest)
call we make in creating the closure that allocates, so we need to guard that
ddaa716
to
114bda2
Compare
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: fejta, stevekuznetsov The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
114bda2
to
3a27750
Compare
3a27750
to
6a7a272
Compare
Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>
6a7a272
to
6b72630
Compare
@@ -38,11 +39,11 @@ type destToWriter func(dest string) dataWriter | |||
// Upload uploads all of the data in the | |||
// uploadTargets map to GCS in parallel. The map is | |||
// keyed on GCS path under the bucket | |||
func Upload(bucket *storage.BucketHandle, uploadTargets map[string]UploadFunc) error { | |||
func Upload(bucket *storage.BucketHandle, uploadTargets map[string]UploadFunc, maxConcurrency int64) error { | |||
dtw := func(dest string) dataWriter { | |||
return gcsObjectWriter{bucket.Object(dest).NewWriter(context.Background())} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is kind of orthogonal to this PR, but we should be using a context with a timeout here so that we don't try to upload a file forever, especially now that that could prevent other files from being uploaded as well.
/lgtm |
Signed-off-by: Steve Kuznetsov skuznets@redhat.com
/cc @fejta @cjwagner @smarterclayton