Merge branch 'master' into kd-live

This commit is contained in:
2023-06-30 16:48:51 +09:00

View File

@ -102,11 +102,12 @@ func zipLogFiles(storageRoot string, req *shared.UploadRequest, start, except st
defer w.Close() defer w.Close()
oldestFile := "" oldestFile := ""
for _, file := range matches { for i, file := range matches {
if file == root { if file == root {
continue continue
} }
if len(except) > 0 && file >= except { if len(except) > 0 && file >= except {
matches = matches[:i]
break break
} }
if len(start) > 0 && file < start { if len(start) > 0 && file < start {
@ -256,7 +257,11 @@ func (hc *houstonClient) launch(meta *procmeta) error {
go func(startFile, nextFile string) { go func(startFile, nextFile string) {
zipFile, srcFiles, err := zipLogFiles(hc.config.StorageRoot, req, startFile, nextFile) zipFile, srcFiles, err := zipLogFiles(hc.config.StorageRoot, req, startFile, nextFile)
if err == nil && len(zipFile) > 0 && len(srcFiles) > 0 { 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) logger.Println("uploadZipLogFile failed :", err)
} }
} else if err != nil { } else if err != nil {