AndrewJSchofield commented on code in PR #14111:
URL: https://github.com/apache/kafka/pull/14111#discussion_r1293735321


##########
clients/src/main/java/org/apache/kafka/clients/Metadata.java:
##########
@@ -81,23 +85,32 @@ public class Metadata implements Closeable {
      *
      * @param refreshBackoffMs         The minimum amount of time that must 
expire between metadata refreshes to avoid busy
      *                                 polling
+     * @param refreshBackoffMaxMs      The maximum amount of time to wait 
between metadata refreshes
      * @param metadataExpireMs         The maximum amount of time that 
metadata can be retained without refresh
      * @param logContext               Log context corresponding to the 
containing client
      * @param clusterResourceListeners List of ClusterResourceListeners which 
will receive metadata updates.
      */
     public Metadata(long refreshBackoffMs,
+                    long refreshBackoffMaxMs,
                     long metadataExpireMs,
                     LogContext logContext,
                     ClusterResourceListeners clusterResourceListeners) {
         this.log = logContext.logger(Metadata.class);
-        this.refreshBackoffMs = refreshBackoffMs;
+        this.refreshBackoff = new ExponentialBackoff(
+            refreshBackoffMs,
+            CommonClientConfigs.RETRY_BACKOFF_EXP_BASE,
+            refreshBackoffMaxMs,
+            CommonClientConfigs.RETRY_BACKOFF_JITTER);
         this.metadataExpireMs = metadataExpireMs;
         this.lastRefreshMs = 0L;
         this.lastSuccessfulRefreshMs = 0L;
+        this.attempts = 0L;
         this.requestVersion = 0;
         this.updateVersion = 0;
         this.needFullUpdate = false;
         this.needPartialUpdate = false;
+        this.backoffOnEquivalentResponses = true;

Review Comment:
   This has now been simplified. Previously was using a flag and a counter to 
keep track of backing off, and it can be done easily with just the counter.



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