28 lines
482 B
Go
28 lines
482 B
Go
package database
|
|
|
|
import (
|
|
"log"
|
|
"log/slog"
|
|
"os"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
func watchdog(w string, db *gorm.DB) {
|
|
slog.Info("performing the watchdog cycle")
|
|
|
|
files, err := GetFiles(db)
|
|
if err != nil {
|
|
slog.Error("failed to retrieve the files indexed from the database", "error", err)
|
|
return
|
|
}
|
|
|
|
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)
|
|
}
|
|
log.Println(i)
|
|
}
|
|
}
|