|
|
@ -1,6 +1,8 @@ |
|
|
|
package filesys |
|
|
|
|
|
|
|
import ( |
|
|
|
"github.com/chrislusf/seaweedfs/weed/filer" |
|
|
|
"github.com/chrislusf/seaweedfs/weed/util" |
|
|
|
"google.golang.org/grpc" |
|
|
|
|
|
|
|
"github.com/chrislusf/seaweedfs/weed/pb" |
|
|
@ -11,10 +13,12 @@ var _ = filer_pb.FilerClient(&WFS{}) |
|
|
|
|
|
|
|
func (wfs *WFS) WithFilerClient(fn func(filer_pb.SeaweedFilerClient) error) error { |
|
|
|
|
|
|
|
err := pb.WithCachedGrpcClient(func(grpcConnection *grpc.ClientConn) error { |
|
|
|
err := util.Retry("filer grpc", filer.ReadWaitTime, func() error { |
|
|
|
return pb.WithCachedGrpcClient(func(grpcConnection *grpc.ClientConn) error { |
|
|
|
client := filer_pb.NewSeaweedFilerClient(grpcConnection) |
|
|
|
return fn(client) |
|
|
|
}, wfs.option.FilerGrpcAddress, wfs.option.GrpcDialOption) |
|
|
|
}) |
|
|
|
|
|
|
|
if err == nil { |
|
|
|
return nil |
|
|
|