File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
crates/rollup-boost/src/flashblocks Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ impl FlashblocksWebsocketConfig {
5353 . with_max_interval ( self . max_interval ( ) )
5454 . with_randomization_factor ( 0 as f64 )
5555 . with_max_elapsed_time ( None )
56+ . with_multiplier ( 2.0 )
5657 . build ( )
5758 }
5859
Original file line number Diff line number Diff line change @@ -95,9 +95,6 @@ impl FlashblocksReceiverService {
9595 let ( ws_stream, _) = connect_async ( self . url . as_str ( ) ) . await ?;
9696 let ( mut write, mut read) = ws_stream. split ( ) ;
9797
98- // if we have successfully connected - reset backoff
99- backoff. reset ( ) ;
100-
10198 info ! ( "Connected to Flashblocks receiver at {}" , self . url) ;
10299 self . metrics . connection_status . set ( 1 ) ;
103100
@@ -202,6 +199,8 @@ impl FlashblocksReceiverService {
202199 }
203200 } ) ;
204201
202+ let connection_start = std:: time:: Instant :: now ( ) ;
203+
205204 let result = tokio:: select! {
206205 result = message_handle => {
207206 result. map_err( |e| FlashblocksReceiverError :: TaskPanic ( e. to_string( ) ) ) ?
@@ -212,6 +211,12 @@ impl FlashblocksReceiverService {
212211 } ;
213212
214213 cancel_token. cancel ( ) ;
214+
215+ // Only reset backoff if connection was stable for the max_interval set
216+ // This prevents rapid reconnection loops when a proxy accepts and immediately drops connections
217+ if connection_start. elapsed ( ) >= backoff. max_interval {
218+ backoff. reset ( ) ;
219+ }
215220 result
216221 }
217222}
You can’t perform that action at this time.
0 commit comments