Skip to content

Commit 4fb0d00

Browse files
authored
fix: ensure file deleted before database record remove (#18)
1 parent a74a972 commit 4fb0d00

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/server.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -402,12 +402,11 @@ func (s *dbserver) DeleteHistoryTestCase(ctx context.Context, historyTestCase *s
402402
if strings.HasPrefix(fileName, "isFilePath-") {
403403
tempDir := os.TempDir()
404404
fullFilePath := filepath.Join(tempDir, fileName)
405-
406405
if err = os.Remove(fullFilePath); err != nil {
407406
log.Printf("Failed to delete file: %s, error: %v\n", fullFilePath, err)
407+
return
408408
}
409409
}
410-
411410
db.Delete(&historyTestResult)
412411
return
413412
}
@@ -435,6 +434,7 @@ func (s *dbserver) DeleteAllHistoryTestCase(ctx context.Context, historyTestCase
435434

436435
if err = os.Remove(fullFilePath); err != nil {
437436
log.Printf("Failed to delete file: %s, error: %v\n", fullFilePath, err)
437+
continue
438438
}
439439
}
440440
db.Delete(&historyTestResult)

0 commit comments

Comments
 (0)