Cleanup migration aborted signal handling

This commit is contained in:
schroda
2026-06-21 16:21:17 +02:00
parent 792c034599
commit d66943242c

View File

@@ -421,9 +421,7 @@ export class MigrationManager {
const searchPromises = entries.map((entry) => const searchPromises = entries.map((entry) =>
MigrationManager.mangaProcessQueue(async () => { MigrationManager.mangaProcessQueue(async () => {
if (signal.aborted) { signal.throwIfAborted();
throw new Error(signal.reason);
}
await MigrationManager.searchForManga(entry.mangaId, entry.mangaTitle, signal, options); await MigrationManager.searchForManga(entry.mangaId, entry.mangaTitle, signal, options);
}), }),
@@ -484,9 +482,7 @@ export class MigrationManager {
const migrationPromises = Object.values(entriesBySource).map((sourceEntries = []) => const migrationPromises = Object.values(entriesBySource).map((sourceEntries = []) =>
MigrationManager.mangaProcessQueue(async () => { MigrationManager.mangaProcessQueue(async () => {
for (const entry of sourceEntries) { for (const entry of sourceEntries) {
if (signal.aborted) { signal.throwIfAborted();
throw new Error(signal.reason);
}
// oxlint-disable-next-line no-await-in-loop // oxlint-disable-next-line no-await-in-loop
await MigrationManager.migrateSingleEntry(entry.mangaId, options, signal); await MigrationManager.migrateSingleEntry(entry.mangaId, options, signal);
@@ -797,9 +793,7 @@ export class MigrationManager {
signal: AbortSignal, signal: AbortSignal,
{ selectHighestChapterNumberSource, performAdvancedSearch }: MigrationBulkSearchSettings, { selectHighestChapterNumberSource, performAdvancedSearch }: MigrationBulkSearchSettings,
): Promise<EntrySourceSearchResult[]> { ): Promise<EntrySourceSearchResult[]> {
if (signal.aborted) { signal.throwIfAborted();
throw new Error(signal.reason);
}
if (!selectHighestChapterNumberSource && MigrationManager.hasHigherSourcePriorityMatch(mangaId, sourceId)) { if (!selectHighestChapterNumberSource && MigrationManager.hasHigherSourcePriorityMatch(mangaId, sourceId)) {
throw new Error('Entry already has a selected match from a higher priority source'); 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) => { const matchUpdatePromises = matches.map(async (match) => {
if (signal.aborted) { signal.throwIfAborted();
throw new Error(signal.reason);
}
return (async () => { return (async () => {
try { try {
@@ -1147,17 +1139,13 @@ export class MigrationManager {
}); });
try { try {
if (signal.aborted) { signal.throwIfAborted();
throw new Error(signal.reason);
}
await MigrationManager.getParallelSourceQueue()(() => { await MigrationManager.getParallelSourceQueue()(() => {
assertIsDefined(entry.selectedMatchSourceId); assertIsDefined(entry.selectedMatchSourceId);
return MigrationManager.getOrCreateSourceQueue(entry.selectedMatchSourceId)(async () => { return MigrationManager.getOrCreateSourceQueue(entry.selectedMatchSourceId)(async () => {
if (signal.aborted) { signal.throwIfAborted();
throw new Error(signal.reason);
}
assertIsDefined(entry.selectedMatchMangaId); assertIsDefined(entry.selectedMatchMangaId);