Report cleanup failures on the upload directory itself

This commit is contained in:
2026-09-08 20:18:52 +02:00
parent cf1c2844bf
commit 8413f05f04
+12 -1
View File
@@ -796,6 +796,12 @@ func collectExpiredFiles(root string, duration time.Duration) ([]string, error)
err := filepath.WalkDir(root, func(path string, d fs.DirEntry, err error) error { err := filepath.WalkDir(root, func(path string, d fs.DirEntry, err error) error {
if err != nil { if err != nil {
// A failure on root itself means the sweep saw nothing at all — an
// unmounted or unreadable volume — so let it reach the caller
// instead of logging it as one more skipped path.
if path == root {
return err
}
log.Printf("Cleanup: skipping %q: %v", path, err) log.Printf("Cleanup: skipping %q: %v", path, err)
return nil return nil
} }
@@ -825,8 +831,13 @@ func collectEmptyDirs(root string) ([]string, error) {
err := filepath.WalkDir(root, func(path string, d fs.DirEntry, err error) error { err := filepath.WalkDir(root, func(path string, d fs.DirEntry, err error) error {
// d is nil when the root itself cannot be read, so this check must // d is nil when the root itself cannot be read, so this check must
// come first. // come first. That case also means the sweep saw nothing at all — an
// unmounted or unreadable volume — so let it reach the caller instead
// of logging it as one more skipped path.
if err != nil { if err != nil {
if path == root {
return err
}
log.Printf("Cleanup: skipping %q: %v", path, err) log.Printf("Cleanup: skipping %q: %v", path, err)
return nil return nil
} }