mirror of
https://github.com/rustfs/rustfs.git
synced 2026-01-16 17:20:33 +00:00
fix: Add retry mechanism for GLOBAL_CONFIG_SYS initialization (#1252)
This commit is contained in:
@@ -243,8 +243,18 @@ async fn run(opt: config::Opt) -> Result<()> {
|
||||
})?;
|
||||
|
||||
ecconfig::init();
|
||||
// config system configuration
|
||||
GLOBAL_CONFIG_SYS.init(store.clone()).await?;
|
||||
// config system configuration, wait for 1 second if failed
|
||||
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_background_replication(store.clone()).await;
|
||||
|
||||
Reference in New Issue
Block a user