From 7aec79d3ad61f2e09c4bb63d738006e1dbd84bfd Mon Sep 17 00:00:00 2001 From: Hampus Date: Mon, 31 Aug 2026 00:06:59 +0200 Subject: [PATCH] perf(worker): throttle the cancel check in the domain sync (#2207) --- fluxer_api/src/api/worker/tasks/SyncDisposableEmailDomains.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fluxer_api/src/api/worker/tasks/SyncDisposableEmailDomains.ts b/fluxer_api/src/api/worker/tasks/SyncDisposableEmailDomains.ts index b843a594c..4d3e3af3f 100644 --- a/fluxer_api/src/api/worker/tasks/SyncDisposableEmailDomains.ts +++ b/fluxer_api/src/api/worker/tasks/SyncDisposableEmailDomains.ts @@ -176,20 +176,20 @@ const syncDisposableEmailDomains: WorkerTaskHandler = async (_payload, helpers) await helpers.reportProgress(0, totalOps, `Applying ${addCount} adds and ${removeCount} removes`); for (const domain of freshSet) { if (currentSet.has(domain)) continue; - await throwIfCancelled(helpers); await adminRepository.addDisposableEmailDomain(domain); added++; if (added % WRITE_PROGRESS_INTERVAL === 0) { await helpers.reportProgress(added + removed, totalOps, null); + await throwIfCancelled(helpers); } } for (const domain of currentSet) { if (freshSet.has(domain)) continue; - await throwIfCancelled(helpers); await adminRepository.removeDisposableEmailDomain(domain); removed++; if (removed % WRITE_PROGRESS_INTERVAL === 0) { await helpers.reportProgress(added + removed, totalOps, null); + await throwIfCancelled(helpers); } } await helpers.reportProgress(totalOps, totalOps, `+${added} added, -${removed} removed`);