mirror of
https://github.com/moghtech/komodo.git
synced 2026-03-12 02:18:32 -05:00
improve PruneAll using docker system prune -a -f
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ pub struct GetSecrets {}
|
||||
//
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Request)]
|
||||
#[response(Vec<Log>)]
|
||||
#[response(Log)]
|
||||
pub struct PruneAll {}
|
||||
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user