Improve the s3 uploader for better performance.

Signed-off-by: dkkb <dabkb@aol.com>
This commit is contained in:
dkkb
2021-06-15 16:53:02 +08:00
committed by ks-ci-bot
parent 4fb434ab84
commit d8cef2bcda
9 changed files with 58 additions and 16 deletions

View File

@@ -115,7 +115,7 @@ func (c *applicationOperator) createApp(app *v1alpha1.HelmApplication, iconData
if len(iconData) != 0 {
// save icon attachment
iconId := idutils.GetUuid(v1alpha1.HelmAttachmentPrefix)
err = c.backingStoreClient.Upload(iconId, iconId, bytes.NewBuffer(iconData))
err = c.backingStoreClient.Upload(iconId, iconId, bytes.NewBuffer(iconData), len(iconData))
if err != nil {
klog.Errorf("save icon attachment failed, error: %s", err)
return nil, err
@@ -498,7 +498,7 @@ func (c *applicationOperator) modifyAppAttachment(app *v1alpha1.HelmApplication,
// add attachment to app
add := idutils.GetUuid("att-")
*attachments = append(*attachments, add)
err = c.backingStoreClient.Upload(add, add, bytes.NewBuffer(request.AttachmentContent))
err = c.backingStoreClient.Upload(add, add, bytes.NewBuffer(request.AttachmentContent), len(request.AttachmentContent))
if err != nil {
return "", err
} else {
@@ -517,7 +517,7 @@ func (c *applicationOperator) modifyAppAttachment(app *v1alpha1.HelmApplication,
}
if len(request.AttachmentContent) != 0 {
add := idutils.GetUuid("att-")
err = c.backingStoreClient.Upload(add, add, bytes.NewBuffer(request.AttachmentContent))
err = c.backingStoreClient.Upload(add, add, bytes.NewBuffer(request.AttachmentContent), len(request.AttachmentContent))
if err != nil {
return "", err
} else {