deterministic rand for rescan trheshold per file

main
bel 2025-05-17 21:05:19 -06:00
parent fba3d635ea
commit a74f741298
1 changed files with 9 additions and 1 deletions

View File

@ -36,7 +36,15 @@ func One(ctx context.Context, p string) error {
return err
}
threshold := 20 + rand.Int()%10
threshold := 20 + rand.New(rand.NewSource(func() int64{
b := md5.New().Sum([]byte(p))
var sum int64
for _, c := range b {
sum += int64(c)
sum *= int64(c)
}
return sum
}())).Int()%10
if daysSince := int(time.Since(last.T).Hours()/24); daysSince > threshold {
log.Printf("asses.One(%s) // no modified check as %vd since last check", shortp, daysSince)
} else if stat, err := os.Stat(p); err != nil {