Report cleanup failures on the upload directory itself
This commit is contained in:
@@ -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 {
|
||||
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)
|
||||
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 {
|
||||
// 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 path == root {
|
||||
return err
|
||||
}
|
||||
log.Printf("Cleanup: skipping %q: %v", path, err)
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user