mirror of
https://github.com/Chevron7Locked/kima-hub.git
synced 2026-06-19 07:37:17 +00:00
3216af18a5
The vibe map projection was only cached in Redis with a 24h TTL. On every expiry (or container restart) the full UMAP worker ran again, taking ~30s on an 8k-track library. Positions are deterministic once the embedding set is fixed, so they belong in the DB. Schema: add nullable map_x, map_y to track_embeddings. Metadata-only ALTER on PG 11+, no table rewrite, zero downtime. Service: - doCompute() now persists positions via a single UPDATE ... FROM UNNEST(...) that handles 8-15k rows in one statement. - computeMapProjection() tries Redis, then DB, then UMAP. When the DB has full coverage the UMAP worker is skipped entirely and the map hydrates from a single join in ~100ms. - appendTrackToProjection() writes the new KNN-interpolated position to the DB so it survives Redis expiry. - hydrateFromDb() returns null unless coverage is 100%, so a newly enriched track without a position still triggers full recompute.