Fix cleanup routine to reset state each cycle and skip removing upload root
This commit is contained in:
@@ -395,6 +395,9 @@ func cleanupProcedure(duration time.Duration, dryRun bool) {
|
||||
if !d.IsDir() {
|
||||
return nil
|
||||
}
|
||||
if filepath.Clean(path) == filepath.Clean(uploadDir) {
|
||||
return nil
|
||||
}
|
||||
empty, err := isDirEmpty(path)
|
||||
if empty {
|
||||
emptyDirs = append(emptyDirs, path)
|
||||
@@ -406,6 +409,8 @@ func cleanupProcedure(duration time.Duration, dryRun bool) {
|
||||
}
|
||||
|
||||
for {
|
||||
oldFiles = oldFiles[:0]
|
||||
emptyDirs = emptyDirs[:0]
|
||||
|
||||
filepath.WalkDir(uploadDir, deleteIfTooOld)
|
||||
for _, file := range oldFiles {
|
||||
|
||||
Reference in New Issue
Block a user