Do not write to DB if there aren't new episodes

We currently do a lot of unessecary DB writes.
This PR should fix that. This is important because
it can get expensive rather quickly.
This commit is contained in:
Olav Sundfør 2024-04-08 10:37:56 +02:00
parent 95d4ecd974
commit d43ef65365
1 changed files with 4 additions and 0 deletions

View File

@ -20,6 +20,10 @@ async function updateFetch(existingSeries: Series) {
return !existingSeries.episodes.find((serieEpisode) => serieEpisode.id === episode.id); return !existingSeries.episodes.find((serieEpisode) => serieEpisode.id === episode.id);
}); });
if (newEpisodes.length === 0) {
return existingSeries;
}
const updated = { const updated = {
...existingSeries, ...existingSeries,
lastFetch: new Date(), lastFetch: new Date(),