diff --git a/internal/watch/watch.go b/internal/watch/watch.go index 7743c01..bd93334 100644 --- a/internal/watch/watch.go +++ b/internal/watch/watch.go @@ -233,16 +233,21 @@ func (w *Watcher) Start() error { snippetTicker := time.NewTicker(snippetInterval) gossipTicker := time.NewTicker(gossipInterval) - // A node that only replicates peers (a server with none of the local - // sources) skips the ingest/derive tickers entirely. Nil channels block - // forever, so the select simply never fires for them. - var browserC, giteaC, gitC, opencodeC, karakeepC, healthC, threadC, snippetC <-chan time.Time + // Derivation always runs. Threads and snippets are computed from rows that + // are already in the log, so a replica needs them exactly as much as the + // origin does — gating them with the ingesters left a replica with an + // almost empty thread list while the data sat right there. + threadC, snippetC := threadTicker.C, snippetTicker.C + + // Ingestion only runs where the sources exist. A node with no local + // sources (KNOX_LOCAL_SOURCES=none) leaves these nil: nil channels block + // forever, so the select never fires for them. + var browserC, giteaC, gitC, opencodeC, karakeepC, healthC <-chan time.Time if LocalSourcesEnabled() { browserC, giteaC, gitC = browserTicker.C, giteaTicker.C, gitTicker.C opencodeC, karakeepC, healthC = opencodeTicker.C, karakeepTicker.C, healthTicker.C - threadC, snippetC = threadTicker.C, snippetTicker.C } else { - log.Printf("[knox] KNOX_LOCAL_SOURCES=none: gossip-only mode, local ingest disabled") + log.Printf("[knox] KNOX_LOCAL_SOURCES=none: local ingest disabled, derivation still active") } var browserRunning, giteaRunning, gitRunning, threadRunning, gossipRunning atomic.Bool var opencodeRunning, karakeepRunning, healthRunning, snippetRunning atomic.Bool