File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed
coprocessor/fhevm-engine/host-listener/src/cmd Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -319,10 +319,21 @@ impl InfiniteLogIter {
319319 let config = websocket_config ( ) ;
320320 let ws = WsConnect :: new ( & self . url )
321321 . with_config ( config)
322- . with_max_retries ( 0 ) ; // disabled, alloy skips events
323- let provider = match ProviderBuilder :: new ( ) . connect_ws ( ws) . await {
324- Ok ( provider) => provider,
325- Err ( _) => anyhow:: bail!( "Cannot get a provider" ) ,
322+ // disabled, retried explicitly later
323+ . with_max_retries ( 0 ) ;
324+ // Timeout to prevent slow reconnection
325+ let provider = tokio:: time:: timeout (
326+ Duration :: from_secs ( self . timeout_request_websocket ) ,
327+ ProviderBuilder :: new ( ) . connect_ws ( ws) ,
328+ ) ;
329+ let provider = match provider. await {
330+ Err ( _) => {
331+ anyhow:: bail!( "Timeout getting provider for logs range" )
332+ }
333+ Ok ( Err ( err) ) => {
334+ anyhow:: bail!( "Cannot get provider for logs range due to {err}" )
335+ }
336+ Ok ( Ok ( provider) ) => provider,
326337 } ;
327338 // Timeout to prevent hanging indefinitely on buggy node
328339 match tokio:: time:: timeout (
You can’t perform that action at this time.
0 commit comments