From 2a2fee18bb2be3c5a63f95fce6ddaafd8d40707d Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Fri, 12 Aug 2016 03:04:17 +0800 Subject: [PATCH] Fix retry behaviour [CRITICAL] --- source/net/filebot/CachedResource.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/net/filebot/CachedResource.java b/source/net/filebot/CachedResource.java index f5c1439e..63a4c213 100644 --- a/source/net/filebot/CachedResource.java +++ b/source/net/filebot/CachedResource.java @@ -115,11 +115,11 @@ public class CachedResource implements Resource { throw e; } catch (IOException e) { // retry or rethrow exception - if (retryCount > 0) { + if (retryCount <= 0) { throw e; } - debug.fine(format("Fetch failed: Retry %d => %s", retryCount, e.getMessage())); + debug.fine(format("Fetch failed: Try again in %d seconds (%d more) => %s", retryWaitTime.getSeconds(), retryCount, e)); Thread.sleep(retryWaitTime.toMillis()); return retry(callable, retryCount - 1, retryWaitTime.multipliedBy(2)); }