refactor(service): drop redundant provider sync serial lock

This commit is contained in:
Tunglies
2026-10-01 14:34:19 +08:00
committed by GitHub
parent c2b6c0378e
commit ecd60d317a
+4 -8
View File
@@ -1008,7 +1008,6 @@ fn decode_hex(encoded: &str) -> Result<Vec<u8>> {
}
static PROVIDER_SYNC_QUEUED: AtomicBool = AtomicBool::new(false);
static PROVIDER_SYNC_SERIAL: Lazy<tokio::sync::Mutex<()>> = Lazy::new(|| tokio::sync::Mutex::new(()));
static SYNC_TEMP_SEQUENCE: AtomicU64 = AtomicU64::new(0);
const RUNTIME_PROVIDER_SYNC_ATTEMPTS: u32 = 4;
const CONTENT_COMPARE_CHUNK: usize = 64 * 1024;
@@ -1027,13 +1026,10 @@ pub(crate) fn request_runtime_provider_sync(delay: Duration) {
),
|index| async move {
let attempt = index as u32 + 1;
let outcome = {
let _serial = PROVIDER_SYNC_SERIAL.lock().await;
if attempt == 1 {
PROVIDER_SYNC_QUEUED.store(false, Ordering::Release);
}
sync_runtime_providers_by_service().await
};
if attempt == 1 {
PROVIDER_SYNC_QUEUED.store(false, Ordering::Release);
}
let outcome = sync_runtime_providers_by_service().await;
match outcome {
Ok(ProviderSync { pending: 0, .. }) => Ok(()),
Ok(ProviderSync { pending, .. }) if attempt < RUNTIME_PROVIDER_SYNC_ATTEMPTS => {