From 76c282c2cbb1b8a1f936f35da5c2f3345c633b51 Mon Sep 17 00:00:00 2001 From: Max Nuding Date: Sun, 20 Jul 2025 11:39:44 +0200 Subject: [PATCH] do not cache empty thumbnail lists --- src/lib/server/db.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lib/server/db.ts b/src/lib/server/db.ts index 933149e..c2a140d 100644 --- a/src/lib/server/db.ts +++ b/src/lib/server/db.ts @@ -1037,6 +1037,12 @@ function getCachedThumbnail(thumbnailUrl: string): SongThumbnailImage[] | null { } function cacheThumbnail(thumbnailUrl: string, thumbnails: SongThumbnailImage[]) { + if (!thumbnails) { + // This usually means, that the data is being saved to cached, + // while the thumbnail generation is not finished yet + logger.debug('will not cache empty thumbnail list', thumbnailUrl); + return; + } const now = new Date().getTime(); const initialSize = thumbnailCache.size; if (initialSize >= maxThumbnailCacheSize) {