refactor: replace tokio Mutex with parking_lot Mutex for improved performance

This commit is contained in:
Tunglies
2025-08-16 02:43:37 +08:00
parent cf1fbb63c4
commit 9cc6dde999
4 changed files with 6 additions and 6 deletions

View File

@@ -14,6 +14,7 @@ use crate::{
}; };
use anyhow::Result; use anyhow::Result;
use chrono::Local; use chrono::Local;
use parking_lot::Mutex;
use std::{ use std::{
fmt, fmt,
fs::{create_dir_all, File}, fs::{create_dir_all, File},
@@ -22,7 +23,6 @@ use std::{
sync::Arc, sync::Arc,
}; };
use tauri_plugin_shell::{process::CommandChild, ShellExt}; use tauri_plugin_shell::{process::CommandChild, ShellExt};
use tokio::sync::Mutex;
#[derive(Debug)] #[derive(Debug)]
pub struct CoreManager { pub struct CoreManager {

View File

@@ -1,6 +1,7 @@
use parking_lot::RwLock;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::{sync::Arc, time::Instant}; use std::{sync::Arc, time::Instant};
use tokio::{sync::RwLock, time::Duration}; use tokio::time::Duration;
use crate::{ use crate::{
ipc::monitor::{IpcStreamMonitor, MonitorData, StreamingParser}, ipc::monitor::{IpcStreamMonitor, MonitorData, StreamingParser},

View File

@@ -1,6 +1,7 @@
use parking_lot::RwLock;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::{sync::Arc, time::Instant}; use std::{sync::Arc, time::Instant};
use tokio::{sync::RwLock, time::Duration}; use tokio::time::Duration;
use crate::{ use crate::{
ipc::monitor::{IpcStreamMonitor, MonitorData, StreamingParser}, ipc::monitor::{IpcStreamMonitor, MonitorData, StreamingParser},

View File

@@ -181,9 +181,7 @@ mod app_init {
builder = builder.plugin(tauri_plugin_devtools::init()); builder = builder.plugin(tauri_plugin_devtools::init());
} }
builder.manage(std::sync::Mutex::new( builder.manage(Mutex::new(state::lightweight::LightWeightState::default()))
state::lightweight::LightWeightState::default(),
))
} }
/// Setup deep link handling /// Setup deep link handling