fix: simplify conditional checks and improve async handler usage across multiple files (#5156)
* fix: simplify conditional checks and improve async handler usage across multiple files * fix: add missing AsyncHandler import in find_processes_by_name function * fix: remove redundant AsyncHandler import in find_processes_by_name function
This commit is contained in:
@@ -50,10 +50,10 @@ impl CoreManager {
|
||||
let now = Instant::now();
|
||||
let mut last = self.last_update.lock();
|
||||
|
||||
if let Some(last_time) = *last {
|
||||
if now.duration_since(last_time) < timing::CONFIG_UPDATE_DEBOUNCE {
|
||||
return Ok(false);
|
||||
}
|
||||
if let Some(last_time) = *last
|
||||
&& now.duration_since(last_time) < timing::CONFIG_UPDATE_DEBOUNCE
|
||||
{
|
||||
return Ok(false);
|
||||
}
|
||||
|
||||
*last = Some(now);
|
||||
|
||||
@@ -65,6 +65,7 @@ impl CoreManager {
|
||||
}
|
||||
|
||||
async fn prepare_startup(&self) -> Result<()> {
|
||||
#[cfg(target_os = "windows")]
|
||||
self.wait_for_service_if_needed().await;
|
||||
|
||||
let mode = match SERVICE_MANAGER.lock().await.current() {
|
||||
@@ -121,7 +122,4 @@ impl CoreManager {
|
||||
|
||||
let _ = backoff::future::retry(backoff, operation).await;
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
async fn wait_for_service_if_needed(&self) {}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
use super::CoreManager;
|
||||
#[cfg(windows)]
|
||||
use crate::process::AsyncHandler;
|
||||
use crate::{
|
||||
AsyncHandler,
|
||||
constants::{process, timing},
|
||||
logging,
|
||||
utils::logging::Type,
|
||||
};
|
||||
use anyhow::{Result, anyhow};
|
||||
use anyhow::Result;
|
||||
#[cfg(windows)]
|
||||
use anyhow::anyhow;
|
||||
|
||||
impl CoreManager {
|
||||
pub async fn cleanup_orphaned_processes(&self) -> Result<()> {
|
||||
|
||||
Reference in New Issue
Block a user