Browse Source

refactor

pull/1547/head
Chris Lu 4 years ago
parent
commit
ee1fc6558a
  1. 2
      weed/command/master.go
  2. 2
      weed/wdclient/masterclient.go

2
weed/command/master.go

@ -145,7 +145,7 @@ func startMaster(masterOption MasterOptions, masterWhiteList []string) {
go func() {
time.Sleep(1500 * time.Millisecond)
if ms.Topo.RaftServer.Leader() == "" && ms.Topo.RaftServer.IsLogEmpty() && isTheFirstOne(myMasterAddress, peers) {
if ms.MasterClient.FindLeader(myMasterAddress) == "" {
if ms.MasterClient.FindLeaderFromOtherPeers(myMasterAddress) == "" {
raftServer.DoJoinCommand()
}
}

2
weed/wdclient/masterclient.go

@ -52,7 +52,7 @@ func (mc *MasterClient) KeepConnectedToMaster() {
}
}
func (mc *MasterClient) FindLeader(myMasterAddress string) (leader string) {
func (mc *MasterClient) FindLeaderFromOtherPeers(myMasterAddress string) (leader string) {
for _, master := range mc.masters {
if master == myMasterAddress {
continue

Loading…
Cancel
Save