diff options
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), ), ]; |