From 75d8ebe80338d9b2dce962542e2beca8e4cca6d0 Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Sat, 27 Dec 2025 15:21:19 +0100 Subject: [PATCH] fix(restart): reset restart count when resource is manually stopped MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a database or application was in a restart loop, the restart count persisted even after the user manually stopped the resource. This caused the UI to continue showing "(Xx restarts)" after user intervention. Now resets restart_count, last_restart_at, and last_restart_type when: - User stops a database (StopDatabase action) - User stops an application (StopApplication action) The existing reset in GetContainersStatus is still needed for containers that exit on their own (crash without recovery, Docker giving up). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Haiku 4.5 --- app/Actions/Application/StopApplication.php | 8 ++++++++ app/Actions/Database/StopDatabase.php | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/app/Actions/Application/StopApplication.php b/app/Actions/Application/StopApplication.php index 94651a3c1..e86e30f04 100644 --- a/app/Actions/Application/StopApplication.php +++ b/app/Actions/Application/StopApplication.php @@ -55,6 +55,14 @@ class StopApplication return $e->getMessage(); } } + + // Reset restart tracking when application is manually stopped + $application->update([ + 'restart_count' => 0, + 'last_restart_at' => null, + 'last_restart_type' => null, + ]); + ServiceStatusChanged::dispatch($application->environment->project->team->id); } } diff --git a/app/Actions/Database/StopDatabase.php b/app/Actions/Database/StopDatabase.php index c024c14e1..4dde509ab 100644 --- a/app/Actions/Database/StopDatabase.php +++ b/app/Actions/Database/StopDatabase.php @@ -28,6 +28,13 @@ class StopDatabase $this->stopContainer($database, $database->uuid, 30); + // Reset restart tracking when database is manually stopped + $database->update([ + 'restart_count' => 0, + 'last_restart_at' => null, + 'last_restart_type' => null, + ]); + if ($dockerCleanup) { CleanupDocker::dispatch($server, false, false); }