From 1b57e9f87e49db072d4b740bf72513d2d596faac Mon Sep 17 00:00:00 2001 From: mountain Date: Fri, 30 Jun 2023 16:48:13 +0900 Subject: [PATCH] =?UTF-8?q?=EC=97=85=EB=A1=9C=EB=93=9C=20=EB=90=9C=20?= =?UTF-8?q?=EB=A1=9C=EA=B7=B8=20=ED=8C=8C=EC=9D=BC=EC=9D=80=20=EC=A7=80?= =?UTF-8?q?=EC=9A=B0=EB=90=98,=20=EC=B5=9C=EC=8B=A0=EB=8F=84=20=EA=B0=99?= =?UTF-8?q?=EC=9D=B4=20=EC=A7=80=EC=9B=8C=EC=A7=80=EB=8D=98=20=EB=AC=B8?= =?UTF-8?q?=EC=A0=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/operation.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/client/operation.go b/client/operation.go index 835e360..997d057 100644 --- a/client/operation.go +++ b/client/operation.go @@ -102,11 +102,12 @@ func zipLogFiles(storageRoot string, req *shared.UploadRequest, start, except st defer w.Close() oldestFile := "" - for _, file := range matches { + for i, file := range matches { if file == root { continue } if len(except) > 0 && file >= except { + matches = matches[:i] break } if len(start) > 0 && file < start { @@ -256,7 +257,11 @@ func (hc *houstonClient) launch(meta *procmeta) error { go func(startFile, nextFile string) { zipFile, srcFiles, err := zipLogFiles(hc.config.StorageRoot, req, startFile, nextFile) if err == nil && len(zipFile) > 0 && len(srcFiles) > 0 { - if err = hc.uploadZipLogFile(zipFile, meta.name, meta.version); err != nil { + if err = hc.uploadZipLogFile(zipFile, meta.name, meta.version); err == nil { + for _, oldf := range srcFiles { + os.Remove(oldf) + } + } else { logger.Println("uploadZipLogFile failed :", err) } } else if err != nil {