master: avoid repeated leader redirection
fix https://github.com/chrislusf/seaweedfs/issues/2146
This commit is contained in:
@@ -37,7 +37,7 @@ type Topology struct {
|
|||||||
chanFullVolumes chan storage.VolumeInfo
|
chanFullVolumes chan storage.VolumeInfo
|
||||||
chanCrowdedVolumes chan storage.VolumeInfo
|
chanCrowdedVolumes chan storage.VolumeInfo
|
||||||
|
|
||||||
Configuration *Configuration
|
Configuration *Configuration
|
||||||
|
|
||||||
RaftServer raft.Server
|
RaftServer raft.Server
|
||||||
}
|
}
|
||||||
@@ -70,6 +70,11 @@ func (t *Topology) IsLeader() bool {
|
|||||||
if t.RaftServer.State() == raft.Leader {
|
if t.RaftServer.State() == raft.Leader {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
if leader, err := t.Leader(); err == nil {
|
||||||
|
if t.RaftServer.Name() == leader {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user