File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
coprocessor/fhevm-engine/host-listener/src/cmd Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -329,9 +329,19 @@ impl InfiniteLogIter {
329329 let ws = WsConnect :: new ( & self . url )
330330 . with_config ( config)
331331 . with_max_retries ( 0 ) ; // disabled, alloy skips events
332- let provider = match ProviderBuilder :: new ( ) . connect_ws ( ws) . await {
333- Ok ( provider) => provider,
334- Err ( _) => anyhow:: bail!( "Cannot get a provider" ) ,
332+ // Timeout to prevent slow reconnection
333+ let provider = tokio:: time:: timeout (
334+ Duration :: from_secs ( self . timeout_request_websocket ) ,
335+ ProviderBuilder :: new ( ) . connect_ws ( ws)
336+ ) ;
337+ let provider = match provider. await {
338+ Err ( _) => {
339+ anyhow:: bail!( "Timeout getting provider for logs range" )
340+ }
341+ Ok ( Err ( err) ) => {
342+ anyhow:: bail!( "Cannot get provider for logs range due to {err}" )
343+ }
344+ Ok ( Ok ( provider) ) => provider,
335345 } ;
336346 // Timeout to prevent hanging indefinitely on buggy node
337347 match tokio:: time:: timeout (
You can’t perform that action at this time.
0 commit comments