mirror of
https://github.com/mjl-/mox.git
synced 2025-07-12 17:04:39 +03:00
switch to math/rand/v2 in most places
this allows removing some ugly instantiations of an rng based on the current time. Intn is now IntN for our concurrency-safe prng wrapper to match the randv2 api. v2 exists since go1.22, which we already require.
This commit is contained in:
@ -1119,7 +1119,7 @@ func hookDeliver(log mlog.Log, h Hook) {
|
||||
} else {
|
||||
backoff = hookIntervals[len(hookIntervals)-1] * time.Duration(2)
|
||||
}
|
||||
backoff += time.Duration(jitter.Intn(200)-100) * backoff / 10000
|
||||
backoff += time.Duration(jitter.IntN(200)-100) * backoff / 10000
|
||||
h.Attempts++
|
||||
now := time.Now()
|
||||
h.NextAttempt = now.Add(backoff)
|
||||
|
@ -1370,7 +1370,7 @@ func deliver(log mlog.Log, resolver dns.Resolver, m0 Msg) {
|
||||
return fmt.Errorf("get message to be delivered: %v", err)
|
||||
}
|
||||
|
||||
backoff = time.Duration(7*60+30+jitter.Intn(10)-5) * time.Second
|
||||
backoff = time.Duration(7*60+30+jitter.IntN(10)-5) * time.Second
|
||||
for i := 0; i < m0.Attempts; i++ {
|
||||
backoff *= time.Duration(2)
|
||||
}
|
||||
|
Reference in New Issue
Block a user