Fix retry behaviour [CRITICAL]

This commit is contained in:
Reinhard Pointner 2016-08-12 03:04:17 +08:00
parent c34411f0c1
commit 2a2fee18bb
1 changed files with 2 additions and 2 deletions

View File

@ -115,11 +115,11 @@ public class CachedResource<K, R> implements Resource<R> {
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));
}