fix(favicon): short TTL for negative favicon cache entries

A failed favicon lookup was cached for a full week (same TTL as a
success), so a transient miss (e.g. the icon not yet indexed upstream)
blacklisted the domain for days. Cache negatives for 6 hours instead so
the next email retries.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Julien Herr
2026-05-25 22:44:35 +02:00
parent bb9fce72ff
commit 5f13126b35
4 changed files with 60 additions and 3 deletions
+7
View File
@@ -31,6 +31,13 @@ export const STATS_KEY = "stats:counters";
/** Default TTL for a cached per-domain favicon (seconds). */
export const ICON_TTL_SECONDS = 7 * 24 * 60 * 60; // 1 week
/**
* TTL for a *negative* favicon cache entry (seconds). Kept short so a transient
* miss (e.g. DuckDuckGo not having indexed the domain yet) self-heals within
* hours instead of blacklisting the domain for a full week.
*/
export const ICON_NEGATIVE_TTL_SECONDS = 6 * 60 * 60; // 6 hours
/** Maximum accepted favicon size (bytes); larger responses are rejected. */
export const MAX_ICON_BYTES = 100 * 1024; // 100 KB