lucasbru commented on code in PR #15693:
URL: https://github.com/apache/kafka/pull/15693#discussion_r1601288163


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerCoordinator.java:
##########
@@ -1033,16 +1035,22 @@ public RequestFuture<Void> commitOffsetsAsync(final 
Map<TopicPartition, OffsetAn
             lookupCoordinator().addListener(new RequestFutureListener<Void>() {
                 @Override
                 public void onSuccess(Void value) {
-                    pendingAsyncCommits.decrementAndGet();
-                    doCommitOffsetsAsync(offsets, callback);
-                    client.pollNoWakeup();
+                    try {
+                        doCommitOffsetsAsync(offsets, callback);
+                        client.pollNoWakeup();
+                    } finally {
+                        pendingAsyncCommits.decrementAndGet();
+                    }
                 }
 
                 @Override
                 public void onFailure(RuntimeException e) {
-                    pendingAsyncCommits.decrementAndGet();
-                    completedOffsetCommits.add(new 
OffsetCommitCompletion(callback, offsets,
+                    try {
+                        completedOffsetCommits.add(new 
OffsetCommitCompletion(callback, offsets,
                             new RetriableCommitFailedException(e)));
+                    } finally {
+                        pendingAsyncCommits.decrementAndGet();
+                    }

Review Comment:
   No, this is just defensive programming



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