From 0c2baf356bcd411758ae6ccb0128298122610f9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olav=20Sundf=C3=B8r?= Date: Mon, 8 Apr 2024 10:39:51 +0200 Subject: [PATCH] Do not write to DB if there aren't new episodes (#27) --- lib/caching.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/caching.ts b/lib/caching.ts index 67e4ac1..72eec24 100644 --- a/lib/caching.ts +++ b/lib/caching.ts @@ -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(),