mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-12-05 14:10:18 +08:00
refactor(backend): share single-owner drivers for background tasks (#8759)
* docs(backend): define background task ownership * refactor(backend): give background operations single task owners * test(backend): remove actor migration regression cases * docs(changelog): drop backend actor migration entry * refactor(backend): extract workspace task drivers * fix(timer): omit profile identifier from panic log * docs(backend): define workspace crate boundaries * refactor(lightweight): use the task countdown driver * refactor(lightweight): name countdown callbacks * refactor(task): simplify driver startup and coalescing requests * refactor(core): bind service handoff to the sidecar generation * refactor(tun): coalesce background run state reconciliation * refactor(core): own sidecar exit resources in one session * refactor(core): remove automatic Windows service handoff * refactor(task): simplify coalescing job signals * refactor(runstate): keep operation status with service state * refactor(dns): coalesce background override synchronization * refactor(sysproxy): own the local guard under its operation lock * fix(tray): read menu settings at publication * fix(dns): retain script lock across caller cancellation * refactor(profiles): own selected node restoration in one task * refactor(timer): own subscription schedules in the scheduler * test(timer): remove the added application test * fix(service): renew provider sync retry budget on refresh
This commit is contained in:
@@ -2,14 +2,19 @@ use crate::core::notify::NoticeStatus;
|
||||
use crate::utils::help;
|
||||
use anyhow::Result;
|
||||
use clash_verge_draft::DraftTransaction;
|
||||
use clash_verge_logging::{Type, logging, logging_error};
|
||||
use clash_verge_task::scheduled_task::{self, CoalescingJob};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_yaml_ng::{Mapping, Value};
|
||||
use sha2::{Digest as _, Sha256};
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::{
|
||||
LazyLock,
|
||||
atomic::{AtomicBool, Ordering},
|
||||
};
|
||||
use tristr::alias::String;
|
||||
|
||||
use super::{Config, IVerge};
|
||||
use crate::core::handle::Handle;
|
||||
use crate::{core::handle::Handle, process::AsyncHandler};
|
||||
|
||||
static PENDING_DNS_OVERRIDE_NOTICE: AtomicBool = AtomicBool::new(false);
|
||||
|
||||
@@ -124,7 +129,18 @@ impl IVerge {
|
||||
}
|
||||
}
|
||||
|
||||
static DNS_OVERRIDE_SYNC: LazyLock<CoalescingJob> = LazyLock::new(|| {
|
||||
AsyncHandler::start_driver(scheduled_task::coalescing(
|
||||
|| async { logging_error!(Type::Config, Config::sync_dns_override().await) },
|
||||
|| logging!(error, Type::Config, "DNS override synchronization panicked"),
|
||||
))
|
||||
});
|
||||
|
||||
impl Config {
|
||||
pub(crate) fn request_dns_override_sync() {
|
||||
DNS_OVERRIDE_SYNC.request();
|
||||
}
|
||||
|
||||
pub(crate) async fn sync_dns_override() -> Result<()> {
|
||||
let _config_write = Self::lock_config_write().await;
|
||||
let state = Self::runtime().await.data_arc().dns_override.clone();
|
||||
|
||||
Reference in New Issue
Block a user