feat(#343): route container restart through rebuild queue
This commit is contained in:
parent
817d94023d
commit
dce2bd0686
4 changed files with 35 additions and 21 deletions
|
|
@ -159,21 +159,21 @@ async fn dispatch(req: &ManagerRequest, coord: &Arc<Coordinator>) -> ManagerResp
|
|||
}
|
||||
}
|
||||
ManagerRequest::Restart { name } => {
|
||||
tracing::info!(%name, "manager: restart");
|
||||
tracing::info!(%name, "manager: enqueue restart");
|
||||
if name == crate::lifecycle::MANAGER_NAME {
|
||||
return ManagerResponse::Err {
|
||||
message: "refusing to restart the manager from itself".into(),
|
||||
};
|
||||
}
|
||||
match lifecycle::restart(name).await {
|
||||
Ok(()) => {
|
||||
coord.kick_agent(name, "container restarted");
|
||||
ManagerResponse::Ok
|
||||
}
|
||||
Err(e) => ManagerResponse::Err {
|
||||
message: format!("{e:#}"),
|
||||
},
|
||||
}
|
||||
coord.rebuild_queue.enqueue(
|
||||
crate::rebuild_queue::QueueKind::Restart,
|
||||
name.to_owned(),
|
||||
crate::rebuild_queue::QueueSource::Manual,
|
||||
"manager `restart` tool".to_owned(),
|
||||
None,
|
||||
);
|
||||
coord.emit_rebuild_queue_snapshot();
|
||||
ManagerResponse::Ok
|
||||
}
|
||||
ManagerRequest::Update { name } => {
|
||||
tracing::info!(%name, "manager: enqueue update");
|
||||
|
|
|
|||
Loading…
Reference in a new issue