Hey, trying to make sure I'm doing this correctly.
Right now I'm having issues with closing streams started with a context
that is passed around and exists for quite awhile.
In this example "ctx" is passed around to many go routines, I want to keep
"ctx" around but passing it to "grpcStream" seems to keep the stream from
actually closing. What I did below fixed the issue but I wanted to know if
it is needed to pass a child context and cancel it for the stream to
actually close. Is CloseSend() not sufficient if the context is still alive?
log.Println("stream starting")
streamCtx, cancel := context.WithCancel(ctx)
defer cancel()
stream, err := grpcStream(streamCtx, otherArgs)
if err != nil {
errCh <- err
return
}
defer stream.CloseSend()
defer log.Println("closing stream")
Thanks!
--
You received this message because you are subscribed to the Google Groups
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit
https://groups.google.com/d/msgid/grpc-io/85470940-69e3-4f4c-aed2-31a3242841a3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.