Skip to content

Commit c7ae2c7

Browse files
Merge 'fix_retry_sleep_time' into 'main'
fix: linear backoff retry sleep with jitter See merge request: !12
2 parents f1f6537 + 4a1607e commit c7ae2c7

2 files changed

Lines changed: 2 additions & 4 deletions

File tree

src/main/java/com/volcengine/vikingdb/runtime/core/retry/LinearBackoffStrategy.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class LinearBackoffStrategy implements RetryStrategy {
2020

2121
private final int maxRetries;
2222
private final long delayMillis;
23-
private final Boolean withJitter;
23+
private final boolean withJitter;
2424

2525
public LinearBackoffStrategy() {
2626
this(Const.DEFAULT_MAX_RETRY_TIMES, Const.DEFAULT_RETRY_INITIAL_DELAY_MS, true);
@@ -50,7 +50,7 @@ public <T> T execute(Callable<T> action) throws Exception {
5050
}
5151
long jitterDelay = withJitter ? ThreadLocalRandom.current().nextLong(delayMillis) : 0;
5252
try {
53-
Thread.sleep(Math.min(jitterDelay + delayMillis, delayMillis));
53+
Thread.sleep(delayMillis + jitterDelay);
5454
} catch (InterruptedException interruptedException) {
5555
Thread.currentThread().interrupt();
5656
throw new RuntimeException("Retry interrupted", interruptedException);

src/main/java/com/volcengine/vikingdb/runtime/core/retry/RetryStrategy.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
package com.volcengine.vikingdb.runtime.core.retry;
55

6-
import com.github.rholder.retry.RetryException;
7-
86
import java.util.concurrent.Callable;
97

108
/**

0 commit comments

Comments
 (0)