diff --git a/client/src/main/java/io/dapr/durabletask/RetryPolicy.java b/client/src/main/java/io/dapr/durabletask/RetryPolicy.java index 6f1bc4b2..3939c8b0 100644 --- a/client/src/main/java/io/dapr/durabletask/RetryPolicy.java +++ b/client/src/main/java/io/dapr/durabletask/RetryPolicy.java @@ -109,8 +109,8 @@ public RetryPolicy setMaxRetryInterval(@Nullable Duration maxRetryInterval) { * @return this retry policy object */ public RetryPolicy setRetryTimeout(Duration retryTimeout) { - if (retryTimeout != null && retryTimeout.compareTo(this.firstRetryInterval) < 0) { - throw new IllegalArgumentException("The value for retryTimeout must be greater than or equal to the value for firstRetryInterval."); + if (retryTimeout == null || retryTimeout.compareTo(this.firstRetryInterval) < 0) { + throw new IllegalArgumentException("The value for retryTimeout cannot be null and must be greater than or equal to the value for firstRetryInterval."); } this.retryTimeout = retryTimeout; return this; diff --git a/client/src/main/java/io/dapr/durabletask/TaskOrchestrationExecutor.java b/client/src/main/java/io/dapr/durabletask/TaskOrchestrationExecutor.java index 388de14f..7191ebb8 100644 --- a/client/src/main/java/io/dapr/durabletask/TaskOrchestrationExecutor.java +++ b/client/src/main/java/io/dapr/durabletask/TaskOrchestrationExecutor.java @@ -1165,10 +1165,14 @@ public V await() { private boolean shouldRetry() { if (this.lastFailure.isNonRetriable()) { - return false; + logger.warning("Not performing any retries because the error is non retriable"); + + return false; } if (this.policy != null) { + logger.warning("Performing retires based on policy"); + return this.shouldRetryBasedOnPolicy(); } else if (this.handler != null) { RetryContext retryContext = new RetryContext( @@ -1184,6 +1188,8 @@ private boolean shouldRetry() { } private boolean shouldRetryBasedOnPolicy() { + logger.warning(this.attemptNumber + " retries out of total %d performed " + this.policy.getMaxNumberOfAttempts()); + if (this.attemptNumber >= this.policy.getMaxNumberOfAttempts()) { // Max number of attempts exceeded return false;