From d66943242c76ca77aefa17807cf9ac394cd32da1 Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Sun, 21 Jun 2026 16:21:17 +0200 Subject: [PATCH] Cleanup migration aborted signal handling --- src/features/migration/MigrationManager.ts | 24 ++++++---------------- 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/src/features/migration/MigrationManager.ts b/src/features/migration/MigrationManager.ts index 34763fc1..209c6c4d 100644 --- a/src/features/migration/MigrationManager.ts +++ b/src/features/migration/MigrationManager.ts @@ -421,9 +421,7 @@ export class MigrationManager { const searchPromises = entries.map((entry) => MigrationManager.mangaProcessQueue(async () => { - if (signal.aborted) { - throw new Error(signal.reason); - } + signal.throwIfAborted(); await MigrationManager.searchForManga(entry.mangaId, entry.mangaTitle, signal, options); }), @@ -484,9 +482,7 @@ export class MigrationManager { const migrationPromises = Object.values(entriesBySource).map((sourceEntries = []) => MigrationManager.mangaProcessQueue(async () => { for (const entry of sourceEntries) { - if (signal.aborted) { - throw new Error(signal.reason); - } + signal.throwIfAborted(); // oxlint-disable-next-line no-await-in-loop await MigrationManager.migrateSingleEntry(entry.mangaId, options, signal); @@ -797,9 +793,7 @@ export class MigrationManager { signal: AbortSignal, { selectHighestChapterNumberSource, performAdvancedSearch }: MigrationBulkSearchSettings, ): Promise { - if (signal.aborted) { - throw new Error(signal.reason); - } + signal.throwIfAborted(); if (!selectHighestChapterNumberSource && MigrationManager.hasHigherSourcePriorityMatch(mangaId, sourceId)) { throw new Error('Entry already has a selected match from a higher priority source'); @@ -855,9 +849,7 @@ export class MigrationManager { ); const matchUpdatePromises = matches.map(async (match) => { - if (signal.aborted) { - throw new Error(signal.reason); - } + signal.throwIfAborted(); return (async () => { try { @@ -1147,17 +1139,13 @@ export class MigrationManager { }); try { - if (signal.aborted) { - throw new Error(signal.reason); - } + signal.throwIfAborted(); await MigrationManager.getParallelSourceQueue()(() => { assertIsDefined(entry.selectedMatchSourceId); return MigrationManager.getOrCreateSourceQueue(entry.selectedMatchSourceId)(async () => { - if (signal.aborted) { - throw new Error(signal.reason); - } + signal.throwIfAborted(); assertIsDefined(entry.selectedMatchMangaId);