fix(cron): wire CACHE_METADATA_DAYS eviction + cross-DB rec_links cap #17

Merged
aureus merged 1 commit from fix/cache-eviction-portable-prune into main 2026-05-26 05:17:47 +00:00
Owner

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. Replaced
with 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.

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. Replaced with 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.
fix(cron): wire CACHE_METADATA_DAYS eviction + cross-DB rec_links cap
All checks were successful
PR Checks / test (pull_request) Successful in 4m31s
1afffb3f83
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.  Replaced
with 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.
aureus merged commit 5abeeb0820 into main 2026-05-26 05:17:47 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
aureus/watchcraft!17
No description provided.