fix: derive threads and snippets on replicate-only nodes (#8)
KNOX_LOCAL_SOURCES=none disabled the auto-threader and snippet extractor along with the ingesters. Both derive from rows already in the log, so a replica has everything they need: the dhg.lol node held 11.5k observations and 4.9k entries but only 2 of the origin's 28 threads, quietly degrading half the MCP surface. Ingestion stays gated; derivation always runs.
This commit is contained in:
+11
-6
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user