Skip to content

Commit b8c8645

Browse files
committed
ref: subscription::recv
1 parent 567b0da commit b8c8645

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/robust_provider/subscription.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,22 +106,21 @@ impl<N: Network> RobustSubscription<N> {
106106
/// * If all providers have been exhausted and failed, returns the last attempt's error.
107107
pub async fn recv(&mut self) -> Result<N::HeaderResponse, Error> {
108108
let subscription_timeout = self.robust_provider.subscription_timeout;
109+
109110
loop {
110-
let recv_result = timeout(subscription_timeout, self.subscription.recv()).await;
111-
match recv_result {
111+
match timeout(subscription_timeout, self.subscription.recv()).await {
112112
Ok(Ok(header)) => {
113113
if self.is_on_fallback() {
114114
self.try_reconnect_to_primary(false).await;
115115
}
116116
return Ok(header);
117117
}
118118
Ok(Err(recv_error)) => return Err(recv_error.into()),
119-
Err(_) => {
119+
Err(_elapsed) => {
120120
warn!(
121121
timeout_secs = subscription_timeout.as_secs(),
122122
"Subscription timeout - no block received, switching provider"
123123
);
124-
125124
self.switch_to_fallback(CoreError::Timeout).await?;
126125
}
127126
}

0 commit comments

Comments
 (0)