Take a tick a little early as the network look's tick

The liveness loop's ticker drifts; a look skipped for a few milliseconds
would wait a whole further tick.
This commit is contained in:
jochen
2026-10-07 18:52:16 +02:00
parent 039abeff69
commit babd32cfc7
+2 -1
View File
@@ -199,7 +199,8 @@ func (j *Judge) Look(ctx context.Context) (Statement, bool) {
j.mu.Lock()
defer j.mu.Unlock()
now := j.m.Now()
if !j.lookedAt.IsZero() && now.Sub(j.lookedAt) < LookEvery {
// A tick a little early is still the tick: the loop that calls this runs on its own clock.
if !j.lookedAt.IsZero() && now.Sub(j.lookedAt) < LookEvery-LookEvery/10 {
return j.said, false
}
j.lookedAt = now