Browse Source

refactor(raft_hashicorp): `timeSpeep` -> `timeSleep` (#3694)

Signed-off-by: Ryan Russell <git@ryanrussell.org>

Signed-off-by: Ryan Russell <git@ryanrussell.org>
pull/3624/merge
Ryan Russell 2 years ago
committed by GitHub
parent
commit
c4fc007630
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      weed/server/raft_hashicorp.go

6
weed/server/raft_hashicorp.go

@ -154,9 +154,9 @@ func NewHashicorpRaftServer(option *RaftServerOption) (*RaftServer, error) {
cfg := s.AddPeersConfiguration() cfg := s.AddPeersConfiguration()
// Need to get lock, in case all servers do this at the same time. // Need to get lock, in case all servers do this at the same time.
peerIdx := getPeerIdx(s.serverAddr, s.peers) peerIdx := getPeerIdx(s.serverAddr, s.peers)
timeSpeep := time.Duration(float64(c.LeaderLeaseTimeout) * (rand.Float64()*0.25 + 1) * float64(peerIdx))
glog.V(0).Infof("Bootstrapping idx: %d sleep: %v new cluster: %+v", peerIdx, timeSpeep, cfg)
time.Sleep(timeSpeep)
timeSleep := time.Duration(float64(c.LeaderLeaseTimeout) * (rand.Float64()*0.25 + 1) * float64(peerIdx))
glog.V(0).Infof("Bootstrapping idx: %d sleep: %v new cluster: %+v", peerIdx, timeSleep, cfg)
time.Sleep(timeSleep)
f := s.RaftHashicorp.BootstrapCluster(cfg) f := s.RaftHashicorp.BootstrapCluster(cfg)
if err := f.Error(); err != nil { if err := f.Error(); err != nil {
return nil, fmt.Errorf("raft.Raft.BootstrapCluster: %v", err) return nil, fmt.Errorf("raft.Raft.BootstrapCluster: %v", err)

Loading…
Cancel
Save