Browse Source

better way to detect a master isLeader

pull/853/head
Chris Lu 6 years ago
parent
commit
7a493bbefa
  1. 3
      weed/topology/topology.go

3
weed/topology/topology.go

@ -50,6 +50,9 @@ func NewTopology(id string, seq sequence.Sequencer, volumeSizeLimit uint64, puls
}
func (t *Topology) IsLeader() bool {
if t.RaftServer!=nil {
return t.RaftServer.State() == raft.Leader
}
if leader, e := t.Leader(); e == nil {
return leader == t.RaftServer.Name()
}

Loading…
Cancel
Save