mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
refactor
This commit is contained in:
parent
06e6341097
commit
ee1fc6558a
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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…
Reference in a new issue