업로드 된 로그 파일은 지우되, 최신도 같이 지워지던 문제 수정

This commit is contained in:
2023-06-30 16:48:13 +09:00
parent 4667d351a8
commit 1b57e9f87e

View File

@ -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 {