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

Merged
olaven merged 1 commits from do-not-write-if-no-new-episodes into main 2024-04-08 08:39:51 +00:00
1 changed files with 4 additions and 0 deletions
Showing only changes of commit d43ef65365 - Show all commits

View File

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