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(); }