mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
[aether-resolver] IJI-636 improve retry with exp back off
* Make jitter smaller * Log errors on 'warn' and 'error' levels * Log exceptions properly GitOrigin-RevId: deeedd0fb21a91275b19b1db816103dd78dff413
This commit is contained in:
committed by
intellij-monorepo-bot
parent
3e160cad78
commit
d2a63c3b8b
@@ -13,7 +13,7 @@ public final class RetryProvider {
|
|||||||
/* Exponential backoff retry requirements */
|
/* Exponential backoff retry requirements */
|
||||||
private static final Random RANDOM = new Random();
|
private static final Random RANDOM = new Random();
|
||||||
private static final double EXP_BACKOFF_FACTOR = 2;
|
private static final double EXP_BACKOFF_FACTOR = 2;
|
||||||
private static final double EXP_BACKOFF_JITTER = 0.3;
|
private static final double EXP_BACKOFF_JITTER = 0.1;
|
||||||
|
|
||||||
private static final Retry DISABLED_SINGLETON = new Retry() {
|
private static final Retry DISABLED_SINGLETON = new Retry() {
|
||||||
@Override
|
@Override
|
||||||
@@ -85,10 +85,10 @@ public final class RetryProvider {
|
|||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
if (i == maxAttempts) {
|
if (i == maxAttempts) {
|
||||||
logger.info("Retry attempts limit exceeded, tried " + maxAttempts + " times. Cause: " + e.getMessage());
|
logger.error("Retry attempts limit exceeded, tried " + maxAttempts + " times. Cause: " + e.getMessage(), e);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
logger.info("Attempt " + i + " of " + maxAttempts + " failed, retrying in " + effectiveDelay + "ms. Cause: " + e.getMessage());
|
logger.warn("Attempt " + i + " of " + maxAttempts + " failed, retrying in " + effectiveDelay + "ms. Cause: " + e.getMessage(), e);
|
||||||
effectiveDelay = exponentialBackOff(effectiveDelay, backoffLimitMs);
|
effectiveDelay = exponentialBackOff(effectiveDelay, backoffLimitMs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user