Fix retry behaviour [CRITICAL]
This commit is contained in:
parent
c34411f0c1
commit
2a2fee18bb
|
@ -115,11 +115,11 @@ public class CachedResource<K, R> implements Resource<R> {
|
||||||
throw e;
|
throw e;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// retry or rethrow exception
|
// retry or rethrow exception
|
||||||
if (retryCount > 0) {
|
if (retryCount <= 0) {
|
||||||
throw e;
|
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());
|
Thread.sleep(retryWaitTime.toMillis());
|
||||||
return retry(callable, retryCount - 1, retryWaitTime.multipliedBy(2));
|
return retry(callable, retryCount - 1, retryWaitTime.multipliedBy(2));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue