diff --git a/folgore-esplora/src/lib.rs b/folgore-esplora/src/lib.rs index 974039d..7d5b4b9 100644 --- a/folgore-esplora/src/lib.rs +++ b/folgore-esplora/src/lib.rs @@ -122,7 +122,10 @@ impl FolgoreBackend for Esplora { "block": null, }); - let chain_tip = self.client.get_height().map_err(|err| error!("{err}"))?; + let chain_tip = self + .recovery_strategy + .apply(|| self.client.get_height().map_err(|err| error!("{err}"))) + .map_err(|err| error!("{err}"))?; if height > chain_tip.into() { let resp = json!({ "blockhash": null, diff --git a/folgore-plugin/src/recovery.rs b/folgore-plugin/src/recovery.rs index fd94140..b5c2b0b 100644 --- a/folgore-plugin/src/recovery.rs +++ b/folgore-plugin/src/recovery.rs @@ -52,6 +52,11 @@ impl RecoveryStrategy for TimeoutRetry { { let mut result = cb(); while result.is_err() { + log::info!( + "running into retry logic due a request failing. Time `{}` waiting `{}` secs", + *self.times.borrow(), + self.timeout.borrow().as_secs() + ); if self.times.borrow().eq(&4) { log::info!( "we try {} times the request but the error persist", @@ -71,6 +76,7 @@ impl RecoveryStrategy for TimeoutRetry { } // This help us to keep the self not mutable. std::thread::sleep(*self.timeout.borrow()); + log::info!("Waiting timeout end"); // now we increase the timeout self.timeout.borrow_mut().mul_assign(2); self.times.borrow_mut().add_assign(1);