From 8bdff3fbcb981f464d8268b12c0e517ec47303f1 Mon Sep 17 00:00:00 2001 From: weisd Date: Wed, 24 Dec 2025 16:38:28 +0800 Subject: [PATCH] fix: Add retry mechanism for GLOBAL_CONFIG_SYS initialization (#1252) --- rustfs/src/main.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/rustfs/src/main.rs b/rustfs/src/main.rs index fbc946cb..2ab33bc0 100644 --- a/rustfs/src/main.rs +++ b/rustfs/src/main.rs @@ -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;