mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-30 00:47:13 +00:00
fix: Add retry mechanism for GLOBAL_CONFIG_SYS initialization (#1252)
This commit is contained in:
+12
-2
@@ -243,8 +243,18 @@ async fn run(opt: config::Opt) -> Result<()> {
|
|||||||
})?;
|
})?;
|
||||||
|
|
||||||
ecconfig::init();
|
ecconfig::init();
|
||||||
// config system configuration
|
// config system configuration, wait for 1 second if failed
|
||||||
GLOBAL_CONFIG_SYS.init(store.clone()).await?;
|
let mut retry_count = 0;
|
||||||
|
|
||||||
|
while let Err(e) = GLOBAL_CONFIG_SYS.init(store.clone()).await {
|
||||||
|
error!("GLOBAL_CONFIG_SYS.init failed {:?}", e);
|
||||||
|
// TODO: check error type
|
||||||
|
retry_count += 1;
|
||||||
|
if retry_count > 15 {
|
||||||
|
return Err(Error::other("GLOBAL_CONFIG_SYS.init failed"));
|
||||||
|
}
|
||||||
|
tokio::time::sleep(tokio::time::Duration::from_secs(1)).await;
|
||||||
|
}
|
||||||
|
|
||||||
// init replication_pool
|
// init replication_pool
|
||||||
init_background_replication(store.clone()).await;
|
init_background_replication(store.clone()).await;
|
||||||
|
|||||||
Reference in New Issue
Block a user