zzzming commented on code in PR #808:
URL: https://github.com/apache/pulsar-client-go/pull/808#discussion_r923858086


##########
pulsar/consumer_impl.go:
##########
@@ -563,6 +566,11 @@ func (c *consumer) Close() {
                }
                wg.Wait()
                close(c.closeCh)
+               closed := closeChanSet[c.messageCh]
+               if !closed {

Review Comment:
   closeChanSet is a global variable. The element in the set is never deleted. 
Would it be more reasonable to create a isClosed (bool) attribute in the 
`consumer` struct. It can be checked at line 569 and 570 as 
   ```
   if !c.isClosed {
       close(c.messageCh)
   }
   ```
   I just do not understand why there is a need to use a global map to track 
the messageCh channel which will not be GCed. Isn't a leak?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to