From 5d215fff8e6545916b44114a199feb100f51ca87 Mon Sep 17 00:00:00 2001 From: CleverWild Date: Thu, 11 Dec 2025 17:28:32 +0100 Subject: [PATCH] fix(controller): absence of stopping before restarting --- src/controller.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/controller.rs b/src/controller.rs index 43ae2c4..5442d23 100644 --- a/src/controller.rs +++ b/src/controller.rs @@ -150,10 +150,25 @@ impl Controller { } pub async fn restart(&self) -> Result<()> { + let instance = self.ctx.require_instance()?; let project = self.ctx.require_project()?; let reconciler = Reconciler { ctx: &self.ctx }; println!("{}", "Restarting container...".cyan()); + + // Stop container first if it's running, otherwise reconciler won't do anything + if self + .ctx + .docker + .is_container_running_by_id(&instance.container_id) + .await? + { + self.ctx + .docker + .stop_container(&instance.container_id, 10) + .await?; + } + reconciler.reconcile(project).await?; println!( "{} {} {}",