From c9eb22e614ca5ca2a15d149042a0806b129fedde Mon Sep 17 00:00:00 2001 From: Matilda Clerke Date: Wed, 25 Sep 2024 16:51:37 +1000 Subject: [PATCH] 7311: Use a 1 second delay between retries in PeerTaskExecutor to match old implementation Signed-off-by: Matilda Clerke --- .../ethereum/eth/manager/peertask/PeerTaskExecutor.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/peertask/PeerTaskExecutor.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/peertask/PeerTaskExecutor.java index ad56987efc..894568b8b7 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/peertask/PeerTaskExecutor.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/peertask/PeerTaskExecutor.java @@ -32,7 +32,6 @@ import java.util.function.Supplier; /** Manages the execution of PeerTasks, respecting their PeerTaskBehavior */ public class PeerTaskExecutor { - private static final long[] WAIT_TIME_BEFORE_RETRY = {0, 20000, 5000}; private final PeerSelector peerSelector; private final PeerTaskRequestSender requestSender; @@ -123,7 +122,7 @@ public class PeerTaskExecutor { } while (--triesRemaining > 0 && executorResult.getResponseCode() != PeerTaskExecutorResponseCode.SUCCESS && executorResult.getResponseCode() != PeerTaskExecutorResponseCode.PEER_DISCONNECTED - && sleepBetweenRetries(WAIT_TIME_BEFORE_RETRY[triesRemaining])); + && sleepBetweenRetries()); return executorResult; } @@ -133,9 +132,10 @@ public class PeerTaskExecutor { return CompletableFuture.supplyAsync(() -> executeAgainstPeer(peerTask, peer)); } - private boolean sleepBetweenRetries(final long sleepTime) { + private boolean sleepBetweenRetries() { try { - Thread.sleep(sleepTime); + //sleep for 1 second to match implemented wait between retries in AbstractRetryingPeerTask + Thread.sleep(1000); return true; } catch (InterruptedException e) { return false;