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



##########
File path: pulsar/internal/connection.go
##########
@@ -697,6 +692,29 @@ func (c *connection) deletePendingRequest(requestID 
uint64) (*request, bool) {
        return request, ok
 }
 
+func (c *connection) failPendingRequests(err error) bool {
+       c.pendingLock.Lock()
+       defer c.pendingLock.Unlock()
+       for id, req := range c.pendingReqs {
+               req.callback(nil, err)
+               delete(c.pendingReqs, id)
+       }
+       return true
+}
+
+func (c *connection) failPendingRequest(requestID uint64, err error) bool {

Review comment:
       Why is there a return value if it's never used? There is already a 
function to delete a pending request. `c.deletePendingRequest(requestID)`.  The 
code in the switch above logs a warning when an unexpected request id is sent 
back by the sever. Should that be added added as well.
   
   ```
   request, ok := c.deletePendingRequest(requestID)
   if !ok {
       c.log.Warnf("Received unexpected error response for request %d of type 
%s",
           requestID, cmdError.GetError())
        return
   }
   errMsg := fmt.Sprintf("server error: %s: %s", cmdError.GetError(), 
cmdError.GetMessage())
   request.callback(nil, errors.New(errMsg))
   ```




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