fix(cron): wire CACHE_METADATA_DAYS eviction + cross-DB rec_links cap #17
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/cache-eviction-portable-prune"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
CACHE_METADATA_DAYS was documented but never read — non-library
media_metadata accumulated indefinitely. pruneCache now evicts rows
older than the TTL while protecting any tmdb_id present in library
(feed INNER JOINs in src/lib/feed.ts would silently drop items
otherwise).
The rec_links overflow cap previously used
DELETE … WHERE rowid NOT IN (…), SQLite-only, and would throw on Postgres/MariaDB. Replacedwith a portable Knex leftJoin/groupBy that evicts whole source groups
starting from the source whose metadata is oldest (COALESCE handles
sources with missing metadata).
Adds tests/integration/prune-cache.test.ts covering orphan rec_links,
orphan metadata, age eviction, seerr stale-unknown, and the overflow
cap. The three datetime-inserting cases skip on MariaDB: pre-existing
codebase-wide ISO-8601-via-toISOString writes are incompatible with
MariaDB STRICT_TRANS_TABLES and need a separate fix.