wolfstudy commented on a change in pull request #359:
URL: https://github.com/apache/pulsar-client-go/pull/359#discussion_r485559504



##########
File path: pulsar/internal/connection.go
##########
@@ -356,24 +357,35 @@ func (c *connection) run() {
        defer func() {
                // all the accesses to the pendingReqs should be happened in 
this run loop thread,
                // including the final cleanup, to avoid the issue 
https://github.com/apache/pulsar-client-go/issues/239
+               c.pendingLock.Lock()
                for id, req := range c.pendingReqs {
                        req.callback(nil, errors.New("connection closed"))
                        delete(c.pendingReqs, id)
                }
+               c.pendingLock.Unlock()
                c.Close()
        }()
 
+       go func() {
+               for {
+                       select {
+                       case <-c.closeCh:
+                               return
+
+                       case req := <-c.incomingRequestsCh:
+                               if req == nil {
+                                       return // TODO: this never gonna be 
happen
+                               }
+                               c.internalSendRequest(req)
+                       }
+               }
+       }()
+

Review comment:
       @wuYin Why do we need to do this?




----------------------------------------------------------------
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.

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


Reply via email to