diff --git a/crates/ecstore/src/store.rs b/crates/ecstore/src/store.rs
index b0cac484c..4f82909c7 100644
--- a/crates/ecstore/src/store.rs
+++ b/crates/ecstore/src/store.rs
@@ -217,7 +217,7 @@ impl ECStore {
let mut times = 0;
let mut interval = 1;
loop {
- if let Ok(fm) = store_init::connect_load_init_formats(
+ match store_init::connect_load_init_formats(
first_is_local,
&disks,
pool_eps.set_count,
@@ -226,15 +226,18 @@ impl ECStore {
)
.await
{
- break fm;
+ Ok(fm) => break Ok(fm),
+ // Wrap the final error if we are giving up
+ Err(e) if times >= 10 => {
+ break Err(Error::other(format!("can not get formats after {} retries, last error: {e}", times)));
+ }
+ // Retrying so just drop the error
+ Err(_) => {}
}
times += 1;
if interval < 16 {
interval *= 2;
}
- if times > 10 {
- return Err(Error::other("can not get formats"));
- }
info!("retrying get formats after {:?}", interval);
select! {
_ = tokio::signal::ctrl_c() => {
@@ -245,7 +248,7 @@ impl ECStore {
}
}
}
- };
+ }?;
if deployment_id.is_none() {
deployment_id = Some(fm.id);
diff --git a/crates/ecstore/src/store_init.rs b/crates/ecstore/src/store_init.rs
index 31ea864e8..0d4303dea 100644
--- a/crates/ecstore/src/store_init.rs
+++ b/crates/ecstore/src/store_init.rs
@@ -27,7 +27,7 @@ use crate::{
};
use futures::future::join_all;
use std::collections::{HashMap, hash_map::Entry};
-use tracing::{info, warn};
+use tracing::{debug, info, warn};
use uuid::Uuid;
pub async fn init_disks(eps: &Endpoints, opt: &DiskOption) -> (Vec