aboutsummaryrefslogtreecommitdiff
path: root/weed/command/watch.go
diff options
context:
space:
mode:
Diffstat (limited to 'weed/command/watch.go')
-rw-r--r--weed/command/watch.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/weed/command/watch.go b/weed/command/watch.go
index 9340db141..3bee0eabe 100644
--- a/weed/command/watch.go
+++ b/weed/command/watch.go
@@ -78,7 +78,10 @@ func runWatch(cmd *Command, args []string) bool {
watchErr := pb.WithFilerClient(*watchFiler, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {
- stream, err := client.SubscribeMetadata(context.Background(), &filer_pb.SubscribeMetadataRequest{
+ ctx, cancel := context.WithCancel(context.Background())
+ defer cancel()
+
+ stream, err := client.SubscribeMetadata(ctx, &filer_pb.SubscribeMetadataRequest{
ClientName: "watch",
PathPrefix: *watchTarget,
SinceNs: time.Now().Add(-*watchStart).UnixNano(),