From fa5925658cb66420a10f2aba18dd5b3f8b7548b9 Mon Sep 17 00:00:00 2001 From: Fabian Date: Mon, 18 Dec 2017 16:29:22 -0300 Subject: [PATCH] Cancel polling if there are no more tries remaining --- .../java/ar/com/wolox/wolmo/networking/utils/CallUtils.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/networking/src/main/java/ar/com/wolox/wolmo/networking/utils/CallUtils.java b/networking/src/main/java/ar/com/wolox/wolmo/networking/utils/CallUtils.java index 99d747d..07a4df6 100644 --- a/networking/src/main/java/ar/com/wolox/wolmo/networking/utils/CallUtils.java +++ b/networking/src/main/java/ar/com/wolox/wolmo/networking/utils/CallUtils.java @@ -52,7 +52,10 @@ private static void pollWithDelay(@IntRange(from = 1) final int triesRemaini @NonNull final Callback 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() { @Override