avoid repeated grpc connection creation
fix https://github.com/chrislusf/seaweedfs/issues/1277
This commit is contained in:
@@ -121,6 +121,9 @@ func (mc *MasterClient) tryConnectToMaster(master string) (nextHintedLeader stri
|
||||
}
|
||||
|
||||
func (mc *MasterClient) WithClient(fn func(client master_pb.SeaweedClient) error) error {
|
||||
for mc.currentMaster == "" {
|
||||
time.Sleep(3 * time.Second)
|
||||
}
|
||||
return pb.WithMasterClient(mc.currentMaster, mc.grpcDialOption, func(client master_pb.SeaweedClient) error {
|
||||
return fn(client)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user