feat: add debug-release profile and limit signal runtime thread to one

This commit is contained in:
Tunglies 2026-02-05 13:46:28 +08:00
parent 5397808f16
commit c3f7ff7aa2
No known key found for this signature in database
GPG Key ID: B9B01B389469B3E8
2 changed files with 19 additions and 12 deletions

View File

@ -40,6 +40,11 @@ opt-level = 0
debug = true
strip = false
[profile.debug-release]
inherits = "fast-release"
codegen-units = 1
split-debuginfo = "unpacked"
[workspace.dependencies]
clash-verge-draft = { path = "crates/clash-verge-draft" }
clash-verge-logging = { path = "crates/clash-verge-logging" }

View File

@ -14,18 +14,20 @@ where
F: Fn() -> Fut + Send + Sync + 'static,
Fut: Future + Send + 'static,
{
RUNTIME.get_or_init(|| match tokio::runtime::Runtime::new() {
Ok(rt) => Some(rt),
Err(e) => {
logging!(
info,
Type::SystemSignal,
"register shutdown signal failed, create tokio runtime error: {}",
e
);
None
}
});
RUNTIME.get_or_init(
|| match tokio::runtime::Builder::new_current_thread().enable_all().build() {
Ok(rt) => Some(rt),
Err(e) => {
logging!(
info,
Type::SystemSignal,
"register shutdown signal failed, create tokio runtime error: {}",
e
);
None
}
},
);
#[cfg(unix)]
unix::register(f);