From fd4398d4c5ab5583059f877b6f96cb70d8026aa9 Mon Sep 17 00:00:00 2001 From: Eugene Kabanov Date: Wed, 24 Jul 2024 01:49:52 +0300 Subject: [PATCH] Fix EL requests should do some sleep before repeating request again. (#6441) --- beacon_chain/el/el_manager.nim | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/beacon_chain/el/el_manager.nim b/beacon_chain/el/el_manager.nim index 6bac6f038..1a2c99e37 100644 --- a/beacon_chain/el/el_manager.nim +++ b/beacon_chain/el/el_manager.nim @@ -1359,6 +1359,14 @@ proc sendNewPayload*( if len(pendingRequests) == 0: # All requests failed, we will continue our attempts until deadline # is not finished. + + # To avoid continous spam of requests when EL node is offline we + # going to sleep until next attempt for + # (NEWPAYLOAD_TIMEOUT / 4) time (2.seconds). + let timeout = + chronos.nanoseconds(NEWPAYLOAD_TIMEOUT.nanoseconds div 4) + await sleepAsync(timeout) + break mainLoop proc forkchoiceUpdatedForSingleEL( @@ -1532,6 +1540,14 @@ proc forkchoiceUpdated*( if len(pendingRequests) == 0: # All requests failed, we will continue our attempts until deadline # is not finished. + + # To avoid continous spam of requests when EL node is offline we + # going to sleep until next attempt for + # (FORKCHOICEUPDATED_TIMEOUT / 4) time (2.seconds). + let timeout = + chronos.nanoseconds(FORKCHOICEUPDATED_TIMEOUT.nanoseconds div 4) + await sleepAsync(timeout) + break mainLoop # TODO can't be defined within exchangeConfigWithSingleEL