diff --git a/weed/pb/filer_pb/filer_client.go b/weed/pb/filer_pb/filer_client.go index 73b66472d..d42e20b34 100644 --- a/weed/pb/filer_pb/filer_client.go +++ b/weed/pb/filer_pb/filer_client.go @@ -83,10 +83,12 @@ func doList(filerClient FilerClient, fullDirPath util.FullPath, prefix string, f } glog.V(3).Infof("read directory: %v", request) - stream, err := client.ListEntries(context.Background(), request) + ctx, cancel := context.WithCancel(context.Background()) + stream, err := client.ListEntries(ctx, request) if err != nil { return fmt.Errorf("list %s: %v", fullDirPath, err) } + defer cancel() var prevEntry *Entry for {