fix: silent start does not take effect (#3708)

* fix: light mode error

* feat: optimize the logic

* fix: clippy issues
This commit is contained in:
希亚的西红柿
2025-06-12 23:39:03 +08:00
committed by GitHub
parent cc39b2734e
commit 4e54b61380
3 changed files with 19 additions and 6 deletions

View File

@@ -1,17 +1,18 @@
use std::sync::Once;
use std::sync::{Arc, Once, OnceLock};
use crate::{logging, utils::logging::Type};
#[derive(Clone)]
pub struct LightWeightState {
#[allow(unused)]
once: Once,
once: Arc<Once>,
pub is_lightweight: bool,
}
impl LightWeightState {
pub fn new() -> Self {
Self {
once: Once::new(),
once: Arc::new(Once::new()),
is_lightweight: false,
}
}
@@ -37,6 +38,7 @@ impl LightWeightState {
impl Default for LightWeightState {
fn default() -> Self {
Self::new()
static INSTANCE: OnceLock<LightWeightState> = OnceLock::new();
INSTANCE.get_or_init(LightWeightState::new).clone()
}
}