pub fn spawn_vector_index_boot_load(
db_path: PathBuf,
vector_index: Arc<Mutex<Option<VectorIndex>>>,
) -> JoinHandle<()>Expand description
#1579 B3 — async boot HNSW warm-up for serve.
Pre-#1579 the daemon built the HNSW graph SYNCHRONOUSLY at boot
(get_all_embeddings + VectorIndex::build on the startup path):
P1 measured spawn→initialize at 40 s for a 10k-vector corpus and
28 min at 100k. This loader moves the whole load+build off the startup path onto a background thread, reusing the #968 double-buffer rebuild machinery: the daemon binds and answers immediately with an EMPTY index; semantic recall degrades to its keyword/FTS blend until the warmed graph swaps in (the #519 proactive conflict check routes to its bounded-scan fallback for the same window via
hnsw::VectorIndex::is_fully_searchable).
Locking discipline: the AppState.vector_index outer mutex is
held only for microsecond-scale steps (seed-extend, schedule,
swap) — NEVER across the graph build, which runs detached on the
#968 rebuild thread. Request handlers therefore keep making
progress throughout the warm-up.
Emits one INFO line when the swap lands so operators can see time-to-semantic-ready in the daemon log.