Technoboy- commented on code in PR #17046:
URL: https://github.com/apache/pulsar/pull/17046#discussion_r943041562
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/Consumer.java:
##########
@@ -290,13 +290,16 @@ public Future<Void> sendMessages(final List<? extends
Entry> entries, EntryBatch
return writePromise;
}
int unackedMessages = totalMessages;
- // Note
- // Must ensure that the message is written to the pendingAcks before
sent is first, because this consumer
- // is possible to disconnect at this time.
- if (pendingAcks != null) {
- for (int i = 0; i < entries.size(); i++) {
- Entry entry = entries.get(i);
- if (entry != null) {
+ int totalEntries = 0;
+
+ for (int i = 0; i < entries.size(); i++) {
+ Entry entry = entries.get(i);
+ if (entry != null) {
+ totalEntries++;
+ // Note
+ // Must ensure that the message is written to the pendingAcks
before sent is first,
+ // because this consumer is possible to disconnect at this
time.
+ if (pendingAcks != null) {
Review Comment:
Why move `pendingAcks` here ?
--
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]