The inline dict cache was a latent bug: no lock (the engine singleton is hit by concurrent Flask + worker threads) and a wholesale-clear cliff at 256 (nuked hot entries). Extracted a thread-safe TTL+LRU TTLCache into an importable core/ module with seam tests (expiry via injected clock, LRU-not-wholesale eviction, a concurrency stress test). Engine now uses it; search is cached too (60s, ownership re-stamped fresh). Deliberately NOT persisted to disk — durable data already lives in video.db; that tier would be over-engineering for a self-hosted app. |
||
|---|---|---|
| .. | ||
| enrichment | ||
| __init__.py | ||
| scanner.py | ||
| sources.py | ||