swarm-queue-based lifecycle notices, replacing push_todo(MANAGER_AGENT)
This commit is contained in:
parent
10a294a2f8
commit
e44ea9d8d4
12 changed files with 388 additions and 142 deletions
|
|
@ -51,7 +51,6 @@ pub fn spawn(coord: Arc<Coordinator>) {
|
|||
if seeded {
|
||||
emit_crash_transitions(&coord, &prev_running, ¤t_running);
|
||||
emit_login_transitions(
|
||||
&coord,
|
||||
&prev_logged_in,
|
||||
¤t_logged_in,
|
||||
&sub_agents,
|
||||
|
|
@ -128,7 +127,6 @@ fn is_deliberate_stop(active: Option<bool>, recently_cleared: Option<bool>) -> b
|
|||
}
|
||||
|
||||
async fn emit_login_transitions(
|
||||
coord: &Coordinator,
|
||||
prev: &HashSet<String>,
|
||||
current: &HashSet<String>,
|
||||
sub_agents: &[String],
|
||||
|
|
@ -136,16 +134,13 @@ async fn emit_login_transitions(
|
|||
) {
|
||||
for agent in current.difference(prev) {
|
||||
tracing::info!(%agent, "agent logged in");
|
||||
let _ = coord
|
||||
.push_todo(
|
||||
hive_sh4re::manager::MANAGER_AGENT,
|
||||
"core",
|
||||
Some(format!("logged_in:{agent}")),
|
||||
format!("agent '{agent}' logged in"),
|
||||
None,
|
||||
false,
|
||||
)
|
||||
.await;
|
||||
crate::swarm_notices::notify(
|
||||
"core",
|
||||
Some(format!("logged_in:{agent}")),
|
||||
format!("agent '{agent}' logged in"),
|
||||
None,
|
||||
)
|
||||
.await;
|
||||
}
|
||||
// Detect transitions into "needs login": an agent that was previously
|
||||
// logged-in goes unsigned (credentials deleted), OR a brand-new agent
|
||||
|
|
@ -168,16 +163,13 @@ async fn emit_login_transitions(
|
|||
.collect();
|
||||
for agent in current_needs.difference(&prev_needs) {
|
||||
tracing::info!(%agent, "agent needs login");
|
||||
let _ = coord
|
||||
.push_todo(
|
||||
hive_sh4re::manager::MANAGER_AGENT,
|
||||
"core",
|
||||
Some(format!("needs_login:{agent}")),
|
||||
format!("agent '{agent}' needs login"),
|
||||
None,
|
||||
false,
|
||||
)
|
||||
.await;
|
||||
crate::swarm_notices::notify(
|
||||
"core",
|
||||
Some(format!("needs_login:{agent}")),
|
||||
format!("agent '{agent}' needs login"),
|
||||
None,
|
||||
)
|
||||
.await;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue