From ef05e242e4a89d780376f5177490d099b0af918e Mon Sep 17 00:00:00 2001 From: pengpengfu <35413731+bigbird-0101@users.noreply.github.com> Date: Mon, 10 Jun 2024 11:31:26 +0800 Subject: [PATCH] fetcher when call uploadHandler ,archive zip, Use newZip instead of the default DefaultZip to improve the fetcher to accept more upload requests. (#2955) --- pkg/fetcher/fetcher.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/fetcher/fetcher.go b/pkg/fetcher/fetcher.go index d7040443..93de0bb6 100644 --- a/pkg/fetcher/fetcher.go +++ b/pkg/fetcher/fetcher.go @@ -611,12 +611,16 @@ func (fetcher *Fetcher) archive(src string, dst string) error { } else { files = append(files, src) } - return archiver.DefaultZip.Archive(files, dst) + zip := archiver.NewZip() + defer zip.Close() + return zip.Archive(files, dst) } // unarchive is a function that unzips a zip file to destination func (fetcher *Fetcher) unarchive(src string, dst string) error { - err := archiver.DefaultZip.Unarchive(src, dst) + zip := archiver.NewZip() + defer zip.Close() + err := zip.Unarchive(src, dst) if err != nil { return fmt.Errorf("failed to unzip file: %w", err) }