Skip to content

Commit e0dbfa9

Browse files
committed
ref: take len out of loop
1 parent 532209e commit e0dbfa9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/robust_provider.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,8 @@ impl<N: Network> RobustProvider<N> {
262262

263263
let mut last_error = result.unwrap_err();
264264

265-
if self.providers.len() > 1 {
265+
let num_providers = self.providers.len();
266+
if num_providers > 1 {
266267
info!("Primary provider failed, trying fallback provider(s)");
267268
}
268269

@@ -273,7 +274,7 @@ impl<N: Network> RobustProvider<N> {
273274
info!("Fallback provider {} doesn't support pubsub, skipping", fallback_num);
274275
continue;
275276
}
276-
info!("Attempting fallback provider {}/{}", fallback_num, self.providers.len() - 1);
277+
info!("Attempting fallback provider {}/{}", fallback_num, num_providers - 1);
277278

278279
match self.try_provider_with_timeout(provider, &operation).await {
279280
Ok(value) => {

0 commit comments

Comments
 (0)