unknowntpo commented on code in PR #21584:
URL: https://github.com/apache/kafka/pull/21584#discussion_r3912043514


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/CommitRequestManager.java:
##########
@@ -276,15 +276,29 @@ private CompletableFuture<Map<TopicPartition, 
OffsetAndMetadata>> requestAutoCom
      */
     private void maybeAutoCommitAsync() {
         if (autoCommitEnabled() && autoCommitState.get().shouldAutoCommit()) {
-            OffsetCommitRequestState requestState = createOffsetCommitRequest(
-                subscriptions.allConsumed(),
-                Long.MAX_VALUE);
-            CompletableFuture<Map<TopicPartition, OffsetAndMetadata>> result = 
requestAutoCommit(requestState);
-            // Reset timer to the interval (even if no request was generated), 
but ensure that if
-            // the request completes with a retriable error, the timer is 
reset to send the next
-            // auto-commit after the backoff expires.
-            resetAutoCommitTimer();
-            maybeResetTimerWithBackoff(result);
+            doAutoCommitAsync();
+        }
+    }
+
+    private void doAutoCommitAsync() {
+        OffsetCommitRequestState requestState = createOffsetCommitRequest(
+            subscriptions.allConsumed(),
+            Long.MAX_VALUE);
+        CompletableFuture<Map<TopicPartition, OffsetAndMetadata>> result = 
requestAutoCommit(requestState);
+        // Reset timer to the interval (even if no request was generated), but 
ensure that if
+        // the request completes with a retriable error, the timer is reset to 
send the next
+        // auto-commit after the backoff expires.
+        resetAutoCommitTimer();
+        maybeResetTimerWithBackoff(result);
+    }

Review Comment:
   Good catch — I choose the second approach the match the cliassic path, 
updated `maybeAutoCommitOnAssignment()` to call `requestAutoCommit()` directly, 
without resetting the periodic timer or applying retry backoff to it.



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