Browse Source

avoid leaking grpc.NewClientStream

pull/1318/head
Chris Lu 5 years ago
parent
commit
1ea9bc66d9
  1. 4
      weed/pb/filer_pb/filer_client.go

4
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) 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 { if err != nil {
return fmt.Errorf("list %s: %v", fullDirPath, err) return fmt.Errorf("list %s: %v", fullDirPath, err)
} }
defer cancel()
var prevEntry *Entry var prevEntry *Entry
for { for {

Loading…
Cancel
Save