mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-17 15:11:21 +00:00
rpc/lib/client: jitter test updates and only to-be run on releases
* Updated code with feedback from @melekes, @ebuchman and @silasdavis. * Added Makefile clause `release` to only run the test on seeing tag `release` during releases i.e ```shell make release ``` which will run the comprehensive and long integration-ish tests.
This commit is contained in:
@ -254,10 +254,11 @@ func (c *WSClient) reconnect() error {
|
||||
c.mtx.Unlock()
|
||||
}()
|
||||
|
||||
_1sAsNs := float64(time.Second.Nanoseconds())
|
||||
// 1s == (1e9 ns) == (1 Billion ns)
|
||||
billionNs := float64(time.Second.Nanoseconds())
|
||||
for {
|
||||
jitter := time.Duration(rand.Float64() * _1sAsNs)
|
||||
backoffDuration := jitter + ((1 << uint(attempt)) * time.Second)
|
||||
jitterSeconds := time.Duration(rand.Float64() * billionNs)
|
||||
backoffDuration := jitterSeconds + ((1 << uint(attempt)) * time.Second)
|
||||
|
||||
c.Logger.Info("reconnecting", "attempt", attempt+1, "backoff_duration", backoffDuration)
|
||||
time.Sleep(backoffDuration)
|
||||
|
Reference in New Issue
Block a user