Ignore destination sources with found matches on search retry

This commit is contained in:
schroda
2026-05-16 21:57:44 +02:00
parent 8d90a91537
commit a15cd20031

View File

@@ -801,7 +801,9 @@ export class MigrationManager {
});
try {
const searchPromises = MigrationManager.getDestinationSourceIds(entry.sourceId).map((destSourceId) =>
const searchPromises = MigrationManager.getDestinationSourceIds(entry.sourceId)
.filter((destSourceId) => !entry.destSourceIdToSearchState[destSourceId])
.map((destSourceId) =>
MigrationManager.getParallelSourceQueue()(async () => {
if (signal.aborted) {
return null;
@@ -880,7 +882,8 @@ export class MigrationManager {
draftMatchEntry?.latestChapterNumber ?? Number.MIN_SAFE_INTEGER;
const hasNewerChapterVsEntry = latestChapterNumber > entryLatestChapterNumber;
const hasNewerChapterVsSelectedMatch = latestChapterNumber > selectedMatchLatestChapterNumber;
const hasNewerChapterVsSelectedMatch =
latestChapterNumber > selectedMatchLatestChapterNumber;
const hasNewerChapter = hasNewerChapterVsEntry && hasNewerChapterVsSelectedMatch;
const hasSameLatestChapterAsSelectedMatch =
@@ -901,7 +904,8 @@ export class MigrationManager {
!draftMatchEntry);
const isPreferredMatch =
!ignoreOutdatedMatch && (isPreferredSourcePriorityMatch || isPreferredChapterNumberMatch);
!ignoreOutdatedMatch &&
(isPreferredSourcePriorityMatch || isPreferredChapterNumberMatch);
if (isPreferredMatch) {
draftEntry.selectedMatchMangaId = bestMatch.id;
draftEntry.selectedMatchSourceId = destSourceId;