lordcheng10 commented on code in PR #18164:
URL: https://github.com/apache/pulsar/pull/18164#discussion_r1002851279


##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java:
##########
@@ -972,6 +972,22 @@ private void sendFlowPermitsToBroker(ClientCnx cnx, int 
numMessages) {
             if (log.isDebugEnabled()) {
                 log.debug("[{}] [{}] Adding {} additional permits", topic, 
subscription, numMessages);
             }
+
+            cnx.ctx().writeAndFlush(Commands.newFlow(consumerId, numMessages))
+                    .addListener(writeFuture -> {
+                        String msg;
+                        if (!writeFuture.isSuccess()) {
+                            msg = String.format("Consumer {} failed to send {} 
permits to broker: {}"
+                                    , consumerId, numMessages, 
writeFuture.cause().getMessage());
+                            increaseAvailablePermits(cnx, numMessages, false);
+                        } else {
+                            msg = String.format("Consumer {} sent {} permits 
to broker", consumerId, numMessages);
+                        }
+                        if (log.isDebugEnabled()) {
+                            log.debug(msg);
+                        }
+                    });
+
             if (log.isDebugEnabled()) {

Review Comment:
   Fixed.



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