mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-27 16:26:16 +08:00
perf(usage): coalesce session-sync notifications and serialize sync execution
Replace per-insert usage notifications with a single notification per sync pass, guard all sync entry points (startup backfill, 60s loop, manual sync) behind a process-wide single-flight tokio mutex, and move blocking file/DB work onto spawn_blocking with MissedTickBehavior::Skip. Extend SessionSyncResult with deferredFiles/suspectedDuplicates observability fields (saturating aggregation) and add a test seam that counts notifications even without an injected AppHandle.
This commit is contained in:
@@ -40,6 +40,8 @@ export interface SessionSyncResult {
|
||||
imported: number;
|
||||
skipped: number;
|
||||
filesScanned: number;
|
||||
suspectedDuplicates: number;
|
||||
deferredFiles: number;
|
||||
errors: string[];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user