do not cache empty thumbnail lists

This commit is contained in:
2025-07-20 11:39:44 +02:00
parent 245995c32d
commit 76c282c2cb

View File

@ -1037,6 +1037,12 @@ function getCachedThumbnail(thumbnailUrl: string): SongThumbnailImage[] | null {
} }
function cacheThumbnail(thumbnailUrl: string, thumbnails: SongThumbnailImage[]) { 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 now = new Date().getTime();
const initialSize = thumbnailCache.size; const initialSize = thumbnailCache.size;
if (initialSize >= maxThumbnailCacheSize) { if (initialSize >= maxThumbnailCacheSize) {