chore: add intermediate changes
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package database
|
||||
|
||||
import (
|
||||
"log"
|
||||
"log/slog"
|
||||
"os"
|
||||
|
||||
@@ -17,11 +16,21 @@ func watchdog(w string, db *gorm.DB) {
|
||||
return
|
||||
}
|
||||
|
||||
var purgeList []string
|
||||
for _, f := range files {
|
||||
i, err := os.Stat(f.Filepath)
|
||||
if err != nil {
|
||||
slog.Error("failed to stat the details for one or more files", "error", err)
|
||||
if os.IsNotExist(err) {
|
||||
purgeList = append(purgeList, f.Filepath)
|
||||
continue
|
||||
}
|
||||
slog.Warn("stat failed", "file", f.Filepath, "error", err)
|
||||
continue
|
||||
}
|
||||
|
||||
if i.IsDir() {
|
||||
purgeList = append(purgeList, f.Filepath) // also mark it for purger if its a directory. We do not want that here
|
||||
}
|
||||
log.Println(i)
|
||||
}
|
||||
slog.Info("purge list", "files", purgeList)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user