diff options
| author | Fuwn <[email protected]> | 2026-03-29 05:07:06 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-03-29 05:07:06 +0000 |
| commit | 4c072c665191619472472cc23c9e2e322611afce (patch) | |
| tree | 27debb65fa996cff39b93d703bf12347270d7882 /apps/proxy/src/index.js | |
| parent | fix(anilist): restore completed list query semantics (diff) | |
| download | due.moe-4c072c665191619472472cc23c9e2e322611afce.tar.xz due.moe-4c072c665191619472472cc23c9e2e322611afce.zip | |
fix(proxy): improve native chapter source routing
Diffstat (limited to 'apps/proxy/src/index.js')
| -rw-r--r-- | apps/proxy/src/index.js | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/apps/proxy/src/index.js b/apps/proxy/src/index.js index 26121f10..592899c0 100644 --- a/apps/proxy/src/index.js +++ b/apps/proxy/src/index.js @@ -267,10 +267,16 @@ const handleMangaChapterCounts = async (request, env, ctx) => { .filter((row) => isRecentFailure(row, bootstrapRetryMinutes(env))) .map((row) => row.anilist_id), ); - const rowsNeedingBackfill = manga.filter((entry) => { + const rowsMissingFromIndex = manga.filter((entry) => { const row = existingRowsById.get(entry.anilistId); if (!row) return !recentFailures.has(entry.anilistId); + return false; + }); + const rowsNeedingVolumeBackfill = manga.filter((entry) => { + const row = existingRowsById.get(entry.anilistId); + + if (!row) return false; return ( entry.progress > 0 && @@ -278,12 +284,19 @@ const handleMangaChapterCounts = async (request, env, ctx) => { !recentFailures.has(entry.anilistId) ); }); - const pendingRows = rowsNeedingBackfill.filter((entry) => + const rowsNeedingBackfill = [ + ...rowsMissingFromIndex, + ...rowsNeedingVolumeBackfill, + ]; + const pendingRows = rowsMissingFromIndex.filter((entry) => bootstrapInFlight.has(entry.anilistId), ); const queueableRows = rowsNeedingBackfill.filter( (entry) => !bootstrapInFlight.has(entry.anilistId), ); + const queueablePendingRows = rowsMissingFromIndex.filter( + (entry) => !bootstrapInFlight.has(entry.anilistId), + ); if (queueableRows.length) ctx.waitUntil( @@ -311,7 +324,7 @@ const handleMangaChapterCounts = async (request, env, ctx) => { ); const pending = [ ...new Set( - [...pendingRows, ...queueableRows].map((entry) => entry.anilistId), + [...pendingRows, ...queueablePendingRows].map((entry) => entry.anilistId), ), ]; |