Skip to content

Commit

Permalink
Core: Log retry sleep time (#11413)
Browse files Browse the repository at this point in the history
  • Loading branch information
sullis authored Oct 31, 2024
1 parent ea61ee4 commit 1d4df34
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/src/main/java/org/apache/iceberg/util/Tasks.java
Original file line number Diff line number Diff line change
Expand Up @@ -454,11 +454,13 @@ private <E extends Exception> void runTaskWithRetry(Task<I, E> task, I item) thr
Math.min(
minSleepTimeMs * Math.pow(scaleFactor, attempt - 1), (double) maxSleepTimeMs);
int jitter = ThreadLocalRandom.current().nextInt(Math.max(1, (int) (delayMs * 0.1)));
int sleepTimeMs = delayMs + jitter;

LOG.warn("Retrying task after failure: {}", e.getMessage(), e);
LOG.warn(
"Retrying task after failure: sleepTimeMs={} {}", sleepTimeMs, e.getMessage(), e);

try {
TimeUnit.MILLISECONDS.sleep(delayMs + jitter);
TimeUnit.MILLISECONDS.sleep(sleepTimeMs);
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
throw new RuntimeException(ie);
Expand Down

0 comments on commit 1d4df34

Please sign in to comment.