diff --git a/presto-main/src/main/java/io/prestosql/server/remotetask/Backoff.java b/presto-main/src/main/java/io/prestosql/server/remotetask/Backoff.java index 2837b1160..ef2cde01e 100644 --- a/presto-main/src/main/java/io/prestosql/server/remotetask/Backoff.java +++ b/presto-main/src/main/java/io/prestosql/server/remotetask/Backoff.java @@ -75,14 +75,13 @@ public Backoff(Duration maxFailureInterval, Ticker ticker, int maxTries) public Backoff(int minTries, Duration maxFailureInterval, Ticker ticker, List backoffDelayIntervals, int maxTries) { checkArgument(minTries > 0, "minTries must be at least 1"); - checkArgument(maxTries > 0, "maxTries must be at least 1"); requireNonNull(maxFailureInterval, "maxFailureInterval is null"); requireNonNull(ticker, "ticker is null"); requireNonNull(backoffDelayIntervals, "backoffDelayIntervals is null"); checkArgument(!backoffDelayIntervals.isEmpty(), "backoffDelayIntervals must contain at least one entry"); this.minTries = minTries; - this.maxTries = maxTries; + this.maxTries = (minTries < maxTries) ? maxTries : minTries; this.maxFailureIntervalNanos = maxFailureInterval.roundTo(NANOSECONDS); this.ticker = ticker; this.backoffDelayIntervalsNanos = backoffDelayIntervals.stream() @@ -100,7 +99,7 @@ public Backoff(int minTries, Duration maxFailureInterval, Ticker ticker, List MAX_RETRIES + this.maxTries = (minTries < MAX_RETRIES) ? MAX_RETRIES : minTries; this.maxFailureIntervalNanos = maxFailureInterval.roundTo(NANOSECONDS); this.ticker = ticker; this.backoffDelayIntervalsNanos = backoffDelayIntervals.stream()