tracing: Fix panic on closed channel #24

Merged
fyrchik merged 1 commit from dstepanov-yadro/frostfs-api-go:fix/tracing-panic into master 2023-04-18 08:08:23 +00:00

View file

@ -51,7 +51,6 @@ func NewGRPCStreamClientInterceptor() grpc.StreamClientInterceptor {
strWrp := newgRPCClientStream(str, desc, finished, done)
go func() {
defer close(finished)
fyrchik marked this conversation as resolved
Review

Who will close it then?

Who will close it then?
Review

No one will close this channel. After goroutine closes done channel no one can write to finished. After GC collects stream, it will be no readers and no writers. It's ok to leave channel open: https://groups.google.com/g/golang-nuts/c/pZwdYRGxCIk/m/qpbHxRRPJdUJ

No one will close this channel. After goroutine closes `done` channel no one can write to `finished`. After GC collects stream, it will be no readers and no writers. It's ok to leave channel open: https://groups.google.com/g/golang-nuts/c/pZwdYRGxCIk/m/qpbHxRRPJdUJ
defer close(done)
defer span.End()