Hisoka-X commented on code in PR #3148:
URL:
https://github.com/apache/incubator-seatunnel/pull/3148#discussion_r1027048963
##########
seatunnel-common/src/main/java/org/apache/seatunnel/common/utils/RetryUtils.java:
##########
@@ -46,18 +51,36 @@ public static <T> T retryWithException(Execution<T,
Exception> execution, RetryM
if (retryMaterial.shouldThrowException()) {
throw e;
}
- } else if (retryMaterial.getSleepTimeMillis() > 0) {
- Thread.sleep(retryMaterial.getSleepTimeMillis());
+ } else {
+ // Otherwise it is retriable and we should retry
+ String attemptMessage = "Failed to execute due to {}.
Retrying attempt ({}/{}) after backoff of {} ms";
+ if (retryMaterial.getSleepTimeMillis() > 0) {
+ long backoff =
retryMaterial.computeRetryWaitTimeMillis(i);
+ log.warn(attemptMessage, e.getCause(), i, retryTimes,
backoff);
+ Thread.sleep(backoff);
+ } else {
+ log.warn(attemptMessage, e.getCause(), i, retryTimes,
0);
+ }
}
}
- } while (i <= retryTimes);
+ } while (i < retryTimes);
if (retryMaterial.shouldThrowException()) {
throw new RuntimeException("Execute given execution failed after
retry " + retryTimes + " times", lastException);
}
return null;
}
public static class RetryMaterial {
+ /**
+ * An arbitrary absolute maximum practical retry time.
+ */
+ public static final long MAX_RETRY_TIME_MS =
TimeUnit.HOURS.toMillis(1);
Review Comment:
The max retry is 1 hours, it's to long. 1 minutes will be better.
--
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]