You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@samza.apache.org by "shekhars-li (via GitHub)" <gi...@apache.org> on 2023/02/01 01:25:47 UTC

[GitHub] [samza] shekhars-li commented on a diff in pull request #1650: Make blob store related retry tunables configurable

shekhars-li commented on code in PR #1650:
URL: https://github.com/apache/samza/pull/1650#discussion_r1092654460


##########
samza-core/src/main/java/org/apache/samza/util/FutureUtil.java:
##########
@@ -144,31 +141,21 @@ public static <K, V> CompletableFuture<Map<K, V>> toFutureOfMap(
 
   public static <T> CompletableFuture<T> executeAsyncWithRetries(String opName,
       Supplier<? extends CompletionStage<T>> action, Predicate<? extends Throwable> abortRetries,
-      ExecutorService executor) {
-    Duration maxDuration = Duration.ofMinutes(10);
+      ExecutorService executor, RetryPolicyConfig retryPolicyConfig) {
 
     RetryPolicy<Object> retryPolicy = new RetryPolicy<>()
-        .withMaxRetries(-1) // Sets maximum retry to unlimited from default of 3 attempts. Retries are now limited by max duration and not retry counts.
-        .withBackoff(100, 312500, ChronoUnit.MILLIS, 5) // 100 ms, 500 ms, 2500 ms, 12.5 s, 1.05 min, 5.20 min, 5.20 min
-        .withMaxDuration(maxDuration)
-        .withJitter(Duration.ofMillis(100))
-        .abortOn(abortRetries) // stop retrying if predicate returns true
-        .onRetry(e -> LOG.warn("Action: {} attempt: {} completed with error {} ms after start. Retrying up to {} ms.",
-            opName, e.getAttemptCount(), e.getElapsedTime().toMillis(), maxDuration.toMillis(), e.getLastFailure()));
-
-    return executeAsyncWithRetries(opName, action, abortRetries, executor, retryPolicy);
-  }
-
-  public static <T> CompletableFuture<T> executeAsyncWithRetries(String opName,
-      Supplier<? extends CompletionStage<T>> action, Predicate<? extends Throwable> abortRetries,
-      ExecutorService executor, RetryPolicy<Object> retryPolicy) {
-
-    RetryPolicy<Object> retryPolicyWithLog = retryPolicy.abortOn(abortRetries)
+        .withMaxRetries(retryPolicyConfig.getMaxRetries())

Review Comment:
   Yes, RetryPolicyConfig is not available yet in the [latest release version](https://repo.maven.apache.org/maven2/net/jodah/failsafe/2.4.4/) of FailSafe library. 



-- 
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: commits-unsubscribe@samza.apache.org

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