From 8fbcb4d0da9c0b6d62987e1cd5e317fcd1172e92 Mon Sep 17 00:00:00 2001 From: "Taro L. Saito" Date: Fri, 16 Jun 2023 14:09:11 -0700 Subject: [PATCH] control (internal): Use Jittering by default in Retry (#3023) Adding randomness to the retry wait interval, called Jittering, is a better behavior in distributed systems so as not to create synthetic retry patterns between multiple programs accessing the same API. --- .../src/main/scala/wvlet/airframe/control/Retry.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airframe-control/src/main/scala/wvlet/airframe/control/Retry.scala b/airframe-control/src/main/scala/wvlet/airframe/control/Retry.scala index 887a1a365a..8199fa22fa 100644 --- a/airframe-control/src/main/scala/wvlet/airframe/control/Retry.scala +++ b/airframe-control/src/main/scala/wvlet/airframe/control/Retry.scala @@ -81,7 +81,7 @@ object Retry extends LogSupport { lastError = NOT_STARTED, retryCount = 0, maxRetry = 3, - retryWaitStrategy = new ExponentialBackOff(retryConfig), + retryWaitStrategy = new Jitter(retryConfig), nextWaitMillis = retryConfig.initialIntervalMillis, baseWaitMillis = retryConfig.initialIntervalMillis, extraWaitMillis = 0