Skip to content

Commit

Permalink
Merge pull request #2227 from hashicorp/b-template-splay
Browse files Browse the repository at this point in the history
Actually randomize the splay in the template
  • Loading branch information
dadgar committed Jan 22, 2017
2 parents d1c45df + 42c5caf commit ab54d7d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion client/consul_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package client

import (
"fmt"
"math/rand"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/install_consul.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -ex

CONSUL_VERSION="0.7.0"
CONSUL_VERSION="0.7.2"
CURDIR=`pwd`

echo Fetching Consul...
Expand Down

0 comments on commit ab54d7d

Please sign in to comment.