aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2021-01-11 02:08:26 -0800
committerChris Lu <chris.lu@gmail.com>2021-01-11 02:08:26 -0800
commit6e12a3a490fe5bc4f57fccf51a9fbdc9d1675ca5 (patch)
tree953a54028d9f00f9c6591debcaf1bc1a6c348d14
parent62ee484d12c2753402e67a4a8ba8490324e4731b (diff)
downloadseaweedfs-6e12a3a490fe5bc4f57fccf51a9fbdc9d1675ca5.tar.xz
seaweedfs-6e12a3a490fe5bc4f57fccf51a9fbdc9d1675ca5.zip
refactoring
-rw-r--r--weed/command/watch.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/weed/command/watch.go b/weed/command/watch.go
index 431a326d7..8aad22019 100644
--- a/weed/command/watch.go
+++ b/weed/command/watch.go
@@ -76,8 +76,9 @@ func runWatch(cmd *Command, args []string) bool {
return false
}
- eachEntryFunc := func(resp *filer_pb.SubscribeMetadataResponse) {
+ eachEntryFunc := func(resp *filer_pb.SubscribeMetadataResponse) error {
fmt.Printf("dir:%s %+v\n", resp.Directory, resp.EventNotification)
+ return nil
}
watchErr := pb.WithFilerClient(*watchFiler, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {
@@ -105,7 +106,9 @@ func runWatch(cmd *Command, args []string) bool {
if !shouldPrint(resp) {
continue
}
- eachEntryFunc(resp)
+ if err = eachEntryFunc(resp); err != nil {
+ return err
+ }
}
})