diff --git a/src/main/java/com/uber/cadence/common/RetryOptions.java b/src/main/java/com/uber/cadence/common/RetryOptions.java index e47cad163..70e4501bd 100644 --- a/src/main/java/com/uber/cadence/common/RetryOptions.java +++ b/src/main/java/com/uber/cadence/common/RetryOptions.java @@ -64,8 +64,11 @@ public static RetryOptions merge(MethodRetry r, RetryOptions o) { } else { builder.setBackoffCoefficient(DEFAULT_BACKOFF_COEFFICIENT); } + int maximumAttempts = merge(r.maximumAttempts(), o.getMaximumAttempts(), int.class); + if (maximumAttempts != 0) { + builder.setMaximumAttempts(maximumAttempts); + } return builder - .setMaximumAttempts(merge(r.maximumAttempts(), o.getMaximumAttempts(), int.class)) .setDoNotRetry(merge(r.doNotRetry(), o.getDoNotRetry())) .validateBuildWithDefaults(); }