bitcoind: only sleep on error if there is >0 retries
Don't sleep if we won't retry.
This commit is contained in:
parent
51ff7d6734
commit
45d601282f
@ -219,8 +219,10 @@ impl BitcoinD {
|
||||
Some(simple_http::Error::Timeout)
|
||||
| Some(simple_http::Error::SocketError(_))
|
||||
| Some(simple_http::Error::HttpErrorCode(503)) => {
|
||||
std::thread::sleep(Duration::from_secs(1));
|
||||
log::debug!("Retrying RPC request to bitcoind: attempt #{}", i);
|
||||
if i <= self.retries {
|
||||
std::thread::sleep(Duration::from_secs(1));
|
||||
log::debug!("Retrying RPC request to bitcoind: attempt #{}", i);
|
||||
}
|
||||
error = Some(e);
|
||||
}
|
||||
_ => return Err(e),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user