From 45dbeb5600d1f552c0134721fe49e8fd1099b5a4 Mon Sep 17 00:00:00 2001 From: Rowan Bohde Date: Wed, 12 Jun 2024 06:34:35 -0500 Subject: [PATCH 01/10] Reduce memory usage for chunked artifact uploads to MinIO (#31325) When using the MinIO storage driver for Actions Artifacts, we found that the chunked artifact required significantly more memory usage to both upload and merge than the local storage driver. This seems to be related to hardcoding a value of `-1` for the size to the MinIO client [which has a warning about memory usage in the respective docs](https://pkg.go.dev/github.com/minio/minio-go/v7#Client.PutObject). Specifying the size in both the upload and merge case reduces memory usage of the MinIO client. Co-authored-by: Kyle D --- routers/api/actions/artifacts_chunks.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/routers/api/actions/artifacts_chunks.go b/routers/api/actions/artifacts_chunks.go index bba8ec5f94..3d1a3891d9 100644 --- a/routers/api/actions/artifacts_chunks.go +++ b/routers/api/actions/artifacts_chunks.go @@ -39,7 +39,7 @@ func saveUploadChunkBase(st storage.ObjectStorage, ctx *ArtifactContext, r = io.TeeReader(r, hasher) } // save chunk to storage - writtenSize, err := st.Save(storagePath, r, -1) + writtenSize, err := st.Save(storagePath, r, contentSize) if err != nil { return -1, fmt.Errorf("save chunk to storage error: %v", err) } @@ -208,7 +208,7 @@ func mergeChunksForArtifact(ctx *ArtifactContext, chunks []*chunkFileItem, st st // save merged file storagePath := fmt.Sprintf("%d/%d/%d.%s", artifact.RunID%255, artifact.ID%255, time.Now().UnixNano(), extension) - written, err := st.Save(storagePath, mergedReader, -1) + written, err := st.Save(storagePath, mergedReader, artifact.FileCompressedSize) if err != nil { return fmt.Errorf("save merged file error: %v", err) } From 21ba5ca03be47a9a7051d13fcfa258bb03dd93df Mon Sep 17 00:00:00 2001 From: silverwind Date: Wed, 12 Jun 2024 16:58:03 +0200 Subject: [PATCH 02/10] Fix navbar `+` menu flashing on page load (#31281) Fixes https://github.com/go-gitea/gitea/pull/31273#issuecomment-2153771331. Same method as used in https://github.com/go-gitea/gitea/pull/30215. All left-opening dropdowns need to use it method. --------- Co-authored-by: wxiaoguang Co-authored-by: Giteabot --- templates/base/head_navbar.tmpl | 6 ++--- templates/repo/issue/labels/label_list.tmpl | 24 +++++++++----------- web_src/css/modules/header.css | 6 ----- web_src/css/modules/navbar.css | 20 ++++++++++++---- web_src/js/components/DiffCommitSelector.vue | 2 +- web_src/js/modules/fomantic/dropdown.js | 16 +++++++++++++ 6 files changed, 46 insertions(+), 28 deletions(-) diff --git a/templates/base/head_navbar.tmpl b/templates/base/head_navbar.tmpl index 2b52247303..4889924819 100644 --- a/templates/base/head_navbar.tmpl +++ b/templates/base/head_navbar.tmpl @@ -4,7 +4,7 @@ {{end}}