mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
chore(config): reset retry interval
Make retry interval random one to avoid join collision.
This commit is contained in:
parent
68afedbd16
commit
26c77fcf9e
@ -4,6 +4,7 @@ import (
|
|||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"math/rand"
|
||||||
"net"
|
"net"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
@ -11,6 +12,7 @@ import (
|
|||||||
"reflect"
|
"reflect"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/coreos/etcd/third_party/github.com/BurntSushi/toml"
|
"github.com/coreos/etcd/third_party/github.com/BurntSushi/toml"
|
||||||
|
|
||||||
@ -98,6 +100,9 @@ func New() *Config {
|
|||||||
c.Peer.Addr = "127.0.0.1:7001"
|
c.Peer.Addr = "127.0.0.1:7001"
|
||||||
c.Peer.HeartbeatInterval = defaultHeartbeatInterval
|
c.Peer.HeartbeatInterval = defaultHeartbeatInterval
|
||||||
c.Peer.ElectionTimeout = defaultElectionTimeout
|
c.Peer.ElectionTimeout = defaultElectionTimeout
|
||||||
|
rand.Seed(time.Now().UTC().UnixNano())
|
||||||
|
// Make maximum twice as minimum.
|
||||||
|
c.RetryInterval = float64(50+rand.Int()%50) * defaultHeartbeatInterval / 1000
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user