c0re: keep power intent in memory, drop agent_power/kv tables and the stop snapshot
This commit is contained in:
parent
fca7f669f5
commit
b77fa9edc3
1 changed files with 222 additions and 553 deletions
|
|
@ -145,32 +145,10 @@ async fn dispatch(req: &HostRequest, coord: Arc<Coordinator>) -> HostResponse {
|
|||
// graceful-stop queue, to re-expand it).
|
||||
let agents = scoped_agents(scope).await?;
|
||||
let infra = scoped_infra(scope);
|
||||
// On a broad stop, remember which agents were actually
|
||||
// running so a later broad `start` restores only those
|
||||
// (not every configured container). A targeted `--agent`
|
||||
// stop must not redefine the restore set.
|
||||
if is_broad_scope(scope) {
|
||||
let mut running = Vec::new();
|
||||
for a in &agents {
|
||||
if lifecycle::is_running(a).await {
|
||||
running.push(a.clone());
|
||||
}
|
||||
}
|
||||
coord.set_last_stopped_running(running);
|
||||
}
|
||||
handle_stop(&coord, &agents, &infra, *graceful).await?
|
||||
}
|
||||
HostRequest::Start { scope } => {
|
||||
let mut agents = scoped_agents(scope).await?;
|
||||
// A broad start restores only the set recorded at the
|
||||
// last broad stop, if any. No record (cold "bring the
|
||||
// hive up", or a daemon restart since the stop) → start
|
||||
// all. Targeted `--agent` start is never filtered.
|
||||
if is_broad_scope(scope)
|
||||
&& let Some(prev) = coord.take_last_stopped_running()
|
||||
{
|
||||
agents.retain(|a| prev.contains(a));
|
||||
}
|
||||
let agents = scoped_agents(scope).await?;
|
||||
let infra = scoped_infra(scope);
|
||||
handle_start(&coord, &agents, &infra).await?
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue