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 @@ -320,9 +320,19 @@ impl InfiniteLogIter {
320320 let ws = WsConnect :: new ( & self . url )
321321 . with_config ( config)
322322 . 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" ) ,
323+ // Timeout to prevent slow reconnection
324+ let provider = tokio:: time:: timeout (
325+ Duration :: from_secs ( self . timeout_request_websocket ) ,
326+ ProviderBuilder :: new ( ) . connect_ws ( ws)
327+ ) ;
328+ let provider = match provider. await {
329+ Err ( _) => {
330+ anyhow:: bail!( "Timeout getting provider for logs range" )
331+ }
332+ Ok ( Err ( err) ) => {
333+ anyhow:: bail!( "Cannot get provider for logs range due to {err}" )
334+ }
335+ Ok ( Ok ( provider) ) => provider,
326336 } ;
327337 // Timeout to prevent hanging indefinitely on buggy node
328338 match tokio:: time:: timeout (
You can’t perform that action at this time.
0 commit comments