check cluster connectivities

This commit is contained in:
chrislu
2022-04-01 17:27:49 -07:00
parent 6d55716fc3
commit 4b5c0e3fa9
2 changed files with 162 additions and 0 deletions

View File

@@ -41,6 +41,11 @@ func (mc *MasterClient) GetMaster() pb.ServerAddress {
return mc.currentMaster
}
func (mc *MasterClient) GetMasters() map[string]pb.ServerAddress {
mc.WaitUntilConnected()
return mc.masters
}
func (mc *MasterClient) WaitUntilConnected() {
for mc.currentMaster == "" {
time.Sleep(time.Duration(rand.Int31n(200)) * time.Millisecond)