Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

Commit

Permalink
Removed the successOccurredAtLeastOnce check. This means that if ther…
Browse files Browse the repository at this point in the history
…e are a certain number of failures in a row, even if values have been produced before, the retry limit will be hit.
  • Loading branch information
ms14981 committed Jul 23, 2019
1 parent ea2f6db commit ff8f23b
Showing 1 changed file with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,24 @@

public class ReductiveWalkerRetryChecker {
private int numRetriesSoFar = 0;
private boolean successOccurredAtLeastOnce = false;
private int retryLimit;

public ReductiveWalkerRetryChecker(int retryLimit) {
this.retryLimit = retryLimit;
}

void retrySuccessful() {
successOccurredAtLeastOnce = true;
numRetriesSoFar = 0;
}

void retryUnsuccessful() {
if (!successOccurredAtLeastOnce) {
numRetriesSoFar++;
if (numRetriesSoFar > retryLimit) {
throw new RetryLimitReachedException();
}
numRetriesSoFar++;
if (numRetriesSoFar > retryLimit) {
throw new RetryLimitReachedException();
}
}

void reset() {
numRetriesSoFar = 0;
successOccurredAtLeastOnce = false;
}
}

0 comments on commit ff8f23b

Please sign in to comment.