7311: Use a 1 second delay between retries in PeerTaskExecutor to match old implementation

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
pull/7628/head
Matilda Clerke 2 months ago
parent ce7d24582c
commit c9eb22e614
  1. 8
      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 */ /** Manages the execution of PeerTasks, respecting their PeerTaskBehavior */
public class PeerTaskExecutor { public class PeerTaskExecutor {
private static final long[] WAIT_TIME_BEFORE_RETRY = {0, 20000, 5000};
private final PeerSelector peerSelector; private final PeerSelector peerSelector;
private final PeerTaskRequestSender requestSender; private final PeerTaskRequestSender requestSender;
@ -123,7 +122,7 @@ public class PeerTaskExecutor {
} while (--triesRemaining > 0 } while (--triesRemaining > 0
&& executorResult.getResponseCode() != PeerTaskExecutorResponseCode.SUCCESS && executorResult.getResponseCode() != PeerTaskExecutorResponseCode.SUCCESS
&& executorResult.getResponseCode() != PeerTaskExecutorResponseCode.PEER_DISCONNECTED && executorResult.getResponseCode() != PeerTaskExecutorResponseCode.PEER_DISCONNECTED
&& sleepBetweenRetries(WAIT_TIME_BEFORE_RETRY[triesRemaining])); && sleepBetweenRetries());
return executorResult; return executorResult;
} }
@ -133,9 +132,10 @@ public class PeerTaskExecutor {
return CompletableFuture.supplyAsync(() -> executeAgainstPeer(peerTask, peer)); return CompletableFuture.supplyAsync(() -> executeAgainstPeer(peerTask, peer));
} }
private boolean sleepBetweenRetries(final long sleepTime) { private boolean sleepBetweenRetries() {
try { try {
Thread.sleep(sleepTime); //sleep for 1 second to match implemented wait between retries in AbstractRetryingPeerTask
Thread.sleep(1000);
return true; return true;
} catch (InterruptedException e) { } catch (InterruptedException e) {
return false; return false;

Loading…
Cancel
Save