cckellogg commented on a change in pull request #539:
URL: https://github.com/apache/pulsar-client-go/pull/539#discussion_r650059843



##########
File path: pulsar/internal/connection.go
##########
@@ -331,10 +335,15 @@ func (c *connection) waitUntilReady() error {
 }
 
 func (c *connection) failLeftRequestsWhenClose() {
+       // wait for outstanding incoming requests to complete before draining
+       // and closing the channel
+       c.incomingRequestsWG.Wait()

Review comment:
       I'm a little confused why are we waiting here?

##########
File path: pulsar/internal/connection.go
##########
@@ -546,8 +555,13 @@ func (c *connection) Write(data Buffer) {
 
 func (c *connection) SendRequest(requestID uint64, req *pb.BaseCommand,
        callback func(command *pb.BaseCommand, err error)) {
-       if c.getState() == connectionClosed {
+       c.incomingRequestsWG.Add(1)

Review comment:
       Why is this waitgroup needed for both send requests?




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