improve PruneAll using docker system prune -a -f

This commit is contained in:
mbecker20
2024-04-03 00:28:58 -07:00
parent 3a5530a186
commit b4754b64d5
3 changed files with 8 additions and 11 deletions

View File

@@ -156,15 +156,7 @@ impl Resolve<PruneAll> for State {
&self,
PruneAll {}: PruneAll,
_: (),
) -> anyhow::Result<Vec<Log>> {
tokio::spawn(async move {
let mut logs = Vec::new();
logs.push(docker::prune_images().await);
logs.push(docker::container::prune_containers().await);
logs.push(docker::network::prune_networks().await);
logs
})
.await
.context("failure in spawned task")
) -> anyhow::Result<Log> {
Ok(docker::prune_system().await)
}
}

View File

@@ -52,3 +52,8 @@ pub fn parse_extra_args(extra_args: &[String]) -> String {
args
}
}
pub async fn prune_system() -> Log {
let command = String::from("docker system prune -a -f");
run_monitor_command("prune system", command).await
}

View File

@@ -49,7 +49,7 @@ pub struct GetSecrets {}
//
#[derive(Serialize, Deserialize, Debug, Clone, Request)]
#[response(Vec<Log>)]
#[response(Log)]
pub struct PruneAll {}
//