deterministic rand for rescan trheshold per file
parent
fba3d635ea
commit
a74f741298
|
|
@ -36,7 +36,15 @@ func One(ctx context.Context, p string) error {
|
||||||
return err
|
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 {
|
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)
|
log.Printf("asses.One(%s) // no modified check as %vd since last check", shortp, daysSince)
|
||||||
} else if stat, err := os.Stat(p); err != nil {
|
} else if stat, err := os.Stat(p); err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue