Browse Source

minor adjustments

random_access_file
Chris Lu 4 years ago
parent
commit
152a6cbc2b
  1. 6
      weed/topology/topology.go

6
weed/topology/topology.go

@ -72,8 +72,7 @@ func (t *Topology) IsLeader() bool {
func (t *Topology) Leader() (string, error) {
l := ""
count := 3
for count > 0 {
for count := 0; count < 3; count++ {
if t.RaftServer != nil {
l = t.RaftServer.Leader()
} else {
@ -82,9 +81,8 @@ func (t *Topology) Leader() (string, error) {
if l != "" {
break
} else {
time.Sleep(time.Duration(5-count) * time.Second)
time.Sleep(time.Duration(5+count) * time.Second)
}
count -= 1
}
return l, nil
}

Loading…
Cancel
Save