mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-24 18:21:38 +00:00
standardize PRNG access (#1411)
* replace math/rand with tmlibs equivalent. * update tmlibs dependency
This commit is contained in:
committed by
Anton Kaliaev
parent
64879c1e6a
commit
ab00bf7c8b
@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"net"
|
||||
"net/http"
|
||||
"sync"
|
||||
@ -266,7 +265,7 @@ func (c *WSClient) reconnect() error {
|
||||
}()
|
||||
|
||||
for {
|
||||
jitterSeconds := time.Duration(rand.Float64() * float64(time.Second)) // 1s == (1e9 ns)
|
||||
jitterSeconds := time.Duration(cmn.RandFloat64() * float64(time.Second)) // 1s == (1e9 ns)
|
||||
backoffDuration := jitterSeconds + ((1 << uint(attempt)) * time.Second)
|
||||
|
||||
c.Logger.Info("reconnecting", "attempt", attempt+1, "backoff_duration", backoffDuration)
|
||||
|
Reference in New Issue
Block a user