refactor(imageproxy): reduce noisy image cache logging (#2789)

This commit is contained in:
fallenbagel
2026-04-01 20:40:14 +08:00
committed by GitHub
parent 4434c45ea7
commit 036d000f26
2 changed files with 15 additions and 16 deletions

View File

@@ -55,17 +55,13 @@ class ImageProxy {
} }
} catch (e) { } catch (e) {
if (e.code === 'ENOENT') { if (e.code === 'ENOENT') {
logger.error('Directory not found', { return;
label: 'Image Cache', }
message: e.message,
});
} else {
logger.error('Failed to read directory', { logger.error('Failed to read directory', {
label: 'Image Cache', label: 'Image Cache',
message: e.message, message: e.message,
}); });
} }
}
logger.info(`Cleared ${deletedImages} stale image(s) from cache '${key}'`, { logger.info(`Cleared ${deletedImages} stale image(s) from cache '${key}'`, {
label: 'Image Cache', label: 'Image Cache',

View File

@@ -141,13 +141,16 @@ router.get('/:jellyfinUserId', async (req, res) => {
const jellyfinAvatarUrl = getJellyfinAvatarUrl(req.params.jellyfinUserId); const jellyfinAvatarUrl = getJellyfinAvatarUrl(req.params.jellyfinUserId);
let imageData = await avatarImageCache.getImage( let imageData;
if (user?.avatarVersion) {
imageData = await avatarImageCache.getImage(
jellyfinAvatarUrl, jellyfinAvatarUrl,
fallbackUrl fallbackUrl
); );
if (imageData.meta.extension === 'json') { if (imageData.meta.extension === 'json') {
// this is a 404 imageData = await avatarImageCache.getImage(fallbackUrl);
}
} else {
imageData = await avatarImageCache.getImage(fallbackUrl); imageData = await avatarImageCache.getImage(fallbackUrl);
} }