lianetm commented on code in PR #15311:
URL: https://github.com/apache/kafka/pull/15311#discussion_r1483072035


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/RequestState.java:
##########
@@ -127,8 +127,16 @@ public void onSuccessfulAttempt(final long currentTimeMs) {
      * @param currentTimeMs Current time in milliseconds
      */
     public void onFailedAttempt(final long currentTimeMs) {
+        onFailedAttempt(currentTimeMs, false);
+    }
+
+    public void onFailedAttempt(final long currentTimeMs, final boolean 
skipBackoff) {
         this.lastReceivedMs = currentTimeMs;
-        this.backoffMs = exponentialBackoff.backoff(numAttempts);
+        if (skipBackoff) {
+            this.backoffMs = 0;
+        } else {
+            this.backoffMs = exponentialBackoff.backoff(numAttempts);
+        }
         this.numAttempts++;

Review Comment:
   I did consider using the `onSuccessfulAttempt`, but did not like it too much 
because even though it does what we need, it did not seem conceptually right 
since it's not exactly a successful case when we get those errors, and that 
could maybe lead to trouble in the future if we start taking some more actions 
on the onSuccessful path I expect. I did not think about the`resetBackoff` one, 
and I actually like it, will go for it and include the `numAttempts` in the 
reset, makes sense. 



-- 
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: jira-unsubscr...@kafka.apache.org

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

Reply via email to