You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/09/28 14:01:04 UTC

[GitHub] [pulsar-client-go] cckellogg commented on a change in pull request #622: Fix logic of command for sendError

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



##########
File path: pulsar/internal/connection.go
##########
@@ -752,38 +752,51 @@ func (c *connection) handleAuthChallenge(authChallenge *pb.CommandAuthChallenge)
 	c.writeCommand(baseCommand(pb.BaseCommand_AUTH_RESPONSE, cmdAuthResponse))
 }
 
-func (c *connection) handleSendError(cmdError *pb.CommandError) {
-	c.log.Warnf("Received send error from server: [%v] : [%s]", cmdError.GetError(), cmdError.GetMessage())
+func (c *connection) handleSendError(sendError *pb.CommandSendError) {
+	c.log.Warnf("Received send error from server: [%v] : [%s]", sendError.GetError(), sendError.GetMessage())
 
-	requestID := cmdError.GetRequestId()
+	producerID := sendError.GetProducerId()
 
-	switch cmdError.GetError() {
+	c.listenersLock.RLock()
+	producerListener := c.listeners[producerID]
+	c.listenersLock.RUnlock()
+
+	switch sendError.GetError() {
 	case pb.ServerError_NotAllowedError:
-		request, ok := c.deletePendingRequest(requestID)
+		_, ok := c.deletePendingProducers(producerID)
 		if !ok {
 			c.log.Warnf("Received unexpected error response for request %d of type %s",
-				requestID, cmdError.GetError())
+				producerID, sendError.GetError())
 			return
 		}
 
-		errMsg := fmt.Sprintf("server error: %s: %s", cmdError.GetError(), cmdError.GetMessage())
-		request.callback(nil, errors.New(errMsg))
+		c.log.Warnf("server error: %s: %s", sendError.GetError(), sendError.GetMessage())
 	case pb.ServerError_TopicTerminatedError:
-		request, ok := c.deletePendingRequest(requestID)
+		_, ok := c.deletePendingProducers(producerID)

Review comment:
       I thought all commands sent to the broker will have a request id? Do we still need to clean those up from the the pending request queue?




-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org