With the PostgreSQL vector engine, each frontend kept the collections it
had opened in an in-memory map and answered "collection not found" for
any other. A collection created through one frontend was unknown to the
others until they restarted, and each frontend listed a different set.
Wrap the in-process collections backend in distributed mode so that the
database is the source of truth:
- lists come from the registry,
- a lookup miss checks the registry before it returns 404, and opens a
collection that exists there (once per name, even under concurrency),
- a cached collection that left the registry is dropped and closed, with
a re-check at most every 5 seconds,
- create and reset publish an event on the existing collection
invalidation subject, so other frontends re-check at once.
Without the postgres engine, or outside distributed mode, nothing changes.
Assisted-by: Claude:claude-sonnet-5-5 go
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Co-authored-by: Ettore Di Giacinto <mudler@localai.io>