waits in case master lost connection

This commit is contained in:
Chris Lu 2021-05-21 02:09:22 -07:00
parent 085a61cb8f
commit 0b00edfc3b

View file

@ -36,6 +36,9 @@ func NewMasterClient(grpcDialOption grpc.DialOption, clientType string, clientHo
} }
func (mc *MasterClient) GetMaster() string { func (mc *MasterClient) GetMaster() string {
for mc.currentMaster == "" {
time.Sleep(time.Duration(rand.Int31n(200)) * time.Millisecond)
}
return mc.currentMaster return mc.currentMaster
} }