properly cancel context for streaming grpc

This commit is contained in:
Chris Lu
2020-09-09 12:07:15 -07:00
parent 7f69acd1f2
commit daf0a449f7
10 changed files with 38 additions and 13 deletions

View File

@@ -212,7 +212,9 @@ func (s3a *S3ApiServer) doListFilerEntries(client filer_pb.SeaweedFilerClient, d
InclusiveStartFrom: false,
}
stream, listErr := client.ListEntries(context.Background(), request)
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
stream, listErr := client.ListEntries(ctx, request)
if listErr != nil {
err = fmt.Errorf("list entires %+v: %v", request, listErr)
return