Skip to content

Commit

Permalink
minimizing debug logs related to the backoff interval
Browse files Browse the repository at this point in the history
  • Loading branch information
shawkins authored and manusa committed Apr 27, 2023
1 parent 279814d commit de7bc54
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,12 @@

import io.fabric8.kubernetes.client.Config;
import io.fabric8.kubernetes.client.RequestConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Optional;
import java.util.concurrent.atomic.AtomicInteger;

public class ExponentialBackoffIntervalCalculator {

private static final Logger logger = LoggerFactory.getLogger(ExponentialBackoffIntervalCalculator.class);
//we were using the same default in multiple places, so it has been moved here for now
private static final int MAX_RETRY_INTERVAL_EXPONENT = 5;

Expand Down Expand Up @@ -57,9 +54,7 @@ public void resetReconnectAttempts() {

public final long nextReconnectInterval() {
int exponentOfTwo = currentReconnectAttempt.getAndIncrement();
long ret = getInterval(exponentOfTwo);
logger.debug("Current reconnect backoff is {} milliseconds (T{})", ret, exponentOfTwo);
return ret;
return getInterval(exponentOfTwo);
}

public int getCurrentReconnectAttempt() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,10 @@ void scheduleReconnect(WatchRequestState state) {
return;
}

logger.debug("Scheduling reconnect task");

long delay = nextReconnectInterval();

logger.debug("Scheduling reconnect task in {} ms", delay);

synchronized (this) {
reconnectAttempt = Utils.schedule(baseOperation.context.getExecutor(), this::reconnect, delay, TimeUnit.MILLISECONDS);
if (isForceClosed()) {
Expand Down

0 comments on commit de7bc54

Please sign in to comment.