Skip to content

Commit

Permalink
Merge pull request #12 from Wolox/fix-pool-with-delay
Browse files Browse the repository at this point in the history
Cancel polling if there are no more tries remaining
  • Loading branch information
Fabian Alvarez authored Dec 18, 2017
2 parents 59cc759 + fa59256 commit f504be3
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ private static <T> void pollWithDelay(@IntRange(from = 1) final int triesRemaini
@NonNull final Callback<T> callback,
@IntRange(from = 0) long delayInMillis,
@NonNull final Timer pollingTimer) {
if (triesRemaining <= 0) callback.onFailure(call, new PollRunOutOfTriesException(call));
if (triesRemaining <= 0) {
callback.onFailure(call, new PollRunOutOfTriesException(call));
return;
}

call.enqueue(new Callback<T>() {
@Override
Expand Down

0 comments on commit f504be3

Please sign in to comment.