aboutsummaryrefslogtreecommitdiff
path: root/weed/shell/command_fs_du.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2020-03-04 00:39:47 -0800
committerChris Lu <chris.lu@gmail.com>2020-03-04 00:39:47 -0800
commitf90c43635d96cace1ab1ca965a56a082f880aa4b (patch)
tree579d389f3dad44b4784b1dcf1a3210d82d4f091a /weed/shell/command_fs_du.go
parentbd5c0a13e8c6456ed0b8f586726c4df4967d963a (diff)
downloadseaweedfs-f90c43635d96cace1ab1ca965a56a082f880aa4b.tar.xz
seaweedfs-f90c43635d96cace1ab1ca965a56a082f880aa4b.zip
refactoring
Diffstat (limited to 'weed/shell/command_fs_du.go')
-rw-r--r--weed/shell/command_fs_du.go9
1 files changed, 2 insertions, 7 deletions
diff --git a/weed/shell/command_fs_du.go b/weed/shell/command_fs_du.go
index 6c31ebdff..ca2f22b57 100644
--- a/weed/shell/command_fs_du.go
+++ b/weed/shell/command_fs_du.go
@@ -4,11 +4,9 @@ import (
"fmt"
"io"
- "google.golang.org/grpc"
-
"github.com/chrislusf/seaweedfs/weed/filer2"
+ "github.com/chrislusf/seaweedfs/weed/pb"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
- "github.com/chrislusf/seaweedfs/weed/util"
)
func init() {
@@ -82,10 +80,7 @@ func duTraverseDirectory(writer io.Writer, filerClient filer2.FilerClient, dir,
func (env *CommandEnv) withFilerClient(filerServer string, filerPort int64, fn func(filer_pb.SeaweedFilerClient) error) error {
filerGrpcAddress := fmt.Sprintf("%s:%d", filerServer, filerPort+10000)
- return util.WithCachedGrpcClient(func(grpcConnection *grpc.ClientConn) error {
- client := filer_pb.NewSeaweedFilerClient(grpcConnection)
- return fn(client)
- }, filerGrpcAddress, env.option.GrpcDialOption)
+ return pb.WithGrpcFilerClient(filerGrpcAddress, env.option.GrpcDialOption, fn)
}