fix: Add retry mechanism for GLOBAL_CONFIG_SYS initialization (#1252)

This commit is contained in:
weisd
2025-12-24 16:38:28 +08:00
committed by GitHub
parent 65d32e693f
commit 8bdff3fbcb

View File

@@ -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;