From b7e053edc3f8215f4acf2cac3d7306bcce40a690 Mon Sep 17 00:00:00 2001 From: ProofOfConcept Date: Thu, 9 Apr 2026 01:05:08 -0400 Subject: [PATCH] Defer graph health computation to first trigger, not startup Loading 23K nodes + building graph was blocking consciousness startup. Now computed on first trigger cycle (runs async from mind loop). Co-Authored-By: Proof of Concept --- src/mind/unconscious.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/mind/unconscious.rs b/src/mind/unconscious.rs index 15f8419..2baa5aa 100644 --- a/src/mind/unconscious.rs +++ b/src/mind/unconscious.rs @@ -116,13 +116,11 @@ impl Unconscious { } agents.sort_by(|a, b| a.name.cmp(&b.name)); - let mut s = Self { + Self { agents, max_concurrent: 2, graph_health: None, last_health_check: None, - }; - s.refresh_health(); - s + } } /// Toggle an agent on/off by name. Returns new enabled state. @@ -167,10 +165,10 @@ impl Unconscious { /// Reap finished agents and spawn new ones. pub async fn trigger(&mut self) { - // Periodic graph health refresh + // Periodic graph health refresh (also on first call) if self.last_health_check .map(|t| t.elapsed() > Duration::from_secs(600)) - .unwrap_or(false) + .unwrap_or(true) { self.refresh_health(); }