|
|
@ -5,6 +5,8 @@ import ( |
|
|
|
"math/rand" |
|
|
|
"time" |
|
|
|
|
|
|
|
"github.com/chrislusf/seaweedfs/weed/filer" |
|
|
|
"github.com/chrislusf/seaweedfs/weed/util" |
|
|
|
"google.golang.org/grpc" |
|
|
|
|
|
|
|
"github.com/chrislusf/seaweedfs/weed/glog" |
|
|
@ -150,10 +152,12 @@ func (mc *MasterClient) tryConnectToMaster(master string) (nextHintedLeader stri |
|
|
|
} |
|
|
|
|
|
|
|
func (mc *MasterClient) WithClient(fn func(client master_pb.SeaweedClient) error) error { |
|
|
|
return util.Retry("master grpc", filer.ReadWaitTime, func() 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) |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |