File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,6 @@ use alloy::{
99 transports:: { RpcError , TransportErrorKind } ,
1010} ;
1111use backon:: { ExponentialBuilder , Retryable } ;
12- use futures:: TryFutureExt ;
1312use thiserror:: Error ;
1413use tokio:: time:: { error as TokioError , timeout} ;
1514use tracing:: { error, info} ;
@@ -353,11 +352,15 @@ impl<N: Network> RobustProvider<N> {
353352 Fut : Future < Output = Result < T , RpcError < TransportErrorKind > > > ,
354353 {
355354 let primary = self . primary ( ) ;
356- self . try_provider_with_timeout ( primary, & operation)
357- . or_else ( |last_error| {
358- self . try_fallback_providers ( & operation, require_pubsub, last_error)
359- } )
360- . await
355+ let result = self . try_provider_with_timeout ( primary, & operation) . await ;
356+
357+ if result. is_ok ( ) {
358+ return result;
359+ }
360+
361+ let last_error = result. unwrap_err ( ) ;
362+
363+ self . try_fallback_providers ( & operation, require_pubsub, last_error) . await
361364 }
362365
363366 pub ( crate ) async fn try_fallback_providers < T : Debug , F , Fut > (
You can’t perform that action at this time.
0 commit comments