shibd commented on code in PR #963:
URL: https://github.com/apache/pulsar-client-go/pull/963#discussion_r1122718668


##########
pulsar/internal/connection.go:
##########
@@ -936,23 +936,29 @@ func (c *connection) ResetLastActive() {
 }
 
 func (c *connection) isIdle() bool {
-       c.pendingLock.Lock()
-       if len(c.pendingReqs) != 0 {
-               return false
+       {
+               c.pendingLock.Lock()
+               defer c.pendingLock.Unlock()
+               if len(c.pendingReqs) != 0 {
+                       return false
+               }
        }
-       c.pendingLock.Unlock()
 
-       c.listenersLock.RLock()
-       if len(c.listeners) != 0 {
-               return false
+       {
+               c.listenersLock.RLock()

Review Comment:
   Can you explain why the previous code had a deadlock? I don't understand why 
it is in `{}`.



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