Actually randomize the splay

This commit is contained in:
Alex Dadgar
2017-01-22 13:50:33 -08:00
parent d1c45dfc9c
commit 42c5cafd2f
2 changed files with 7 additions and 2 deletions

View File

@@ -2,6 +2,7 @@ package client
import (
"fmt"
"math/rand"
"os"
"path/filepath"
"strings"
@@ -261,8 +262,12 @@ WAIT:
if restart || len(signals) != 0 {
if splay != 0 {
ns := splay.Nanoseconds()
offset := rand.Int63n(ns)
t := time.Duration(offset)
select {
case <-time.After(time.Duration(splay)):
case <-time.After(t):
case <-tm.shutdownCh:
return
}

View File

@@ -2,7 +2,7 @@
set -ex
CONSUL_VERSION="0.7.0"
CONSUL_VERSION="0.7.2"
CURDIR=`pwd`
echo Fetching Consul...