diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-08-10 20:42:27 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-08-10 20:42:27 -0700 |
| commit | 152a6cbc2b1b5586df9fc3a47a7631ea7a7ae1a6 (patch) | |
| tree | 70c7e23aee5ff831e782eef048bc6ce6567eeb53 | |
| parent | f1b40567e38818a682ab62d4b8374166612ced25 (diff) | |
| download | seaweedfs-152a6cbc2b1b5586df9fc3a47a7631ea7a7ae1a6.tar.xz seaweedfs-152a6cbc2b1b5586df9fc3a47a7631ea7a7ae1a6.zip | |
minor adjustments
| -rw-r--r-- | weed/topology/topology.go | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/weed/topology/topology.go b/weed/topology/topology.go index f93d2179c..a11a1bac6 100644 --- a/weed/topology/topology.go +++ b/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,15 +81,14 @@ 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 } func (t *Topology) Lookup(collection string, vid needle.VolumeId) (dataNodes []*DataNode) { - //maybe an issue if lots of collections? + // maybe an issue if lots of collections? if collection == "" { for _, c := range t.collectionMap.Items() { if list := c.(*Collection).Lookup(vid); list != nil { |
