Skip to content

Commit 23e2903

Browse files
committed
fix: RPC retry delay - use thread::sleep in sync context
1 parent 023be7e commit 23e2903

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/main.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ use std::{
2525
atomic::{AtomicBool, Ordering},
2626
Arc,
2727
},
28+
thread::sleep,
2829
time::Duration,
2930
};
30-
use tokio::time::sleep;
3131
use uuid::Uuid;
3232
pub mod api;
3333
#[rustfmt::skip]
@@ -45,7 +45,7 @@ use crate::solana_program::{
4545
};
4646

4747
const MAINNET_GENESIS_HASH: &str = "5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d";
48-
const MAX_RETRIES: u32 = 5;
48+
const MAX_RETRIES: u32 = 3;
4949
const INITIAL_RETRY_DELAY_MS: u64 = 500;
5050

5151
pub fn get_network(network_str: &str) -> &str {
@@ -1728,13 +1728,13 @@ where
17281728
Err(err) if attempts < MAX_RETRIES => {
17291729
attempts += 1;
17301730
println!(
1731-
"RPC call failed (attempt {}/{}) - retrying in {} ms... Error: {}",
1732-
attempts, MAX_RETRIES, delay, err
1731+
"RPC call failed (attempt {}/{}) - retrying in {} ms...",
1732+
attempts, MAX_RETRIES, delay
17331733
);
1734-
_ = sleep(Duration::from_millis(delay));
1734+
sleep(Duration::from_millis(delay));
17351735
delay *= 2;
17361736
}
17371737
Err(err) => return Err(err),
17381738
}
17391739
}
1740-
}
1740+
}

0 commit comments

Comments
 (0)