refactor: remove update semaphore from CoreManager and related config update logic
This commit is contained in:
@@ -39,11 +39,6 @@ impl CoreManager {
|
|||||||
return Ok((true, String::new()));
|
return Ok((true, String::new()));
|
||||||
}
|
}
|
||||||
|
|
||||||
let _permit = self
|
|
||||||
.update_semaphore
|
|
||||||
.try_acquire()
|
|
||||||
.map_err(|_| anyhow!("Config update already in progress"))?;
|
|
||||||
|
|
||||||
self.perform_config_update().await
|
self.perform_config_update().await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ mod state;
|
|||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
use std::{fmt, sync::Arc, time::Instant};
|
use std::{fmt, sync::Arc, time::Instant};
|
||||||
use tokio::sync::Semaphore;
|
|
||||||
|
|
||||||
use crate::process::CommandChildGuard;
|
use crate::process::CommandChildGuard;
|
||||||
use crate::singleton_lazy;
|
use crate::singleton_lazy;
|
||||||
@@ -30,7 +29,6 @@ impl fmt::Display for RunningMode {
|
|||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct CoreManager {
|
pub struct CoreManager {
|
||||||
state: Arc<Mutex<State>>,
|
state: Arc<Mutex<State>>,
|
||||||
update_semaphore: Arc<Semaphore>,
|
|
||||||
last_update: Arc<Mutex<Option<Instant>>>,
|
last_update: Arc<Mutex<Option<Instant>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,7 +51,6 @@ impl Default for CoreManager {
|
|||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
state: Arc::new(Mutex::new(State::default())),
|
state: Arc::new(Mutex::new(State::default())),
|
||||||
update_semaphore: Arc::new(Semaphore::new(1)),
|
|
||||||
last_update: Arc::new(Mutex::new(None)),
|
last_update: Arc::new(Mutex::new(None)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user