avoid leaking grpc.NewClientStream

This commit is contained in:
Chris Lu 2020-05-17 08:56:33 -07:00
parent 85b53ac510
commit 1ea9bc66d9

View file

@ -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 {