-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Fix: Service status stuck at starting after stop #7479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
When stopping a service that's currently deploying, mark any IN_PROGRESS or QUEUED activities as CANCELLED. This prevents the status from remaining stuck at "starting" after containers are stopped. Follows the existing pattern used in forceDeploy().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a bug where a service's status remains stuck at "starting" after stopping the service. The fix cancels any in-progress or queued deployment activities when StopService is invoked, following a similar pattern to the existing forceDeploy() method.
Key Changes:
- Added logic to cancel in-progress/queued activities before stopping service containers
- Imported
ProcessStatusenum andActivitymodel to support activity cancellation - Activities with IN_PROGRESS or QUEUED status are updated to CANCELLED status
| ->orWhere('properties->status', ProcessStatus::QUEUED->value); | ||
| }) | ||
| ->each(function ($activity) { | ||
| $activity->properties = $activity->properties->put('status', ProcessStatus::CANCELLED->value); |
Copilot
AI
Dec 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The property modification approach is inconsistent with the existing pattern in forceDeploy(). In app/Livewire/Project/Service/Heading.php:115, the code directly assigns to the property:
$activity->properties->status = ProcessStatus::ERROR->value;This code uses:
$activity->properties = $activity->properties->put('status', ProcessStatus::CANCELLED->value);Consider using direct assignment for consistency:
$activity->properties->status = ProcessStatus::CANCELLED->value;| $activity->properties = $activity->properties->put('status', ProcessStatus::CANCELLED->value); | |
| $activity->properties->status = ProcessStatus::CANCELLED->value; |
| Activity::where('properties->type_uuid', $service->uuid) | ||
| ->where(function ($q) { | ||
| $q->where('properties->status', ProcessStatus::IN_PROGRESS->value) | ||
| ->orWhere('properties->status', ProcessStatus::QUEUED->value); | ||
| }) | ||
| ->each(function ($activity) { | ||
| $activity->properties = $activity->properties->put('status', ProcessStatus::CANCELLED->value); | ||
| $activity->save(); | ||
| }); |
Copilot
AI
Dec 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] For consistency with the existing forceDeploy() pattern (lines 109-117 in app/Livewire/Project/Service/Heading.php), consider using .get() with a foreach loop instead of .each():
$activities = Activity::where('properties->type_uuid', $service->uuid)
->where(function ($q) {
$q->where('properties->status', ProcessStatus::IN_PROGRESS->value)
->orWhere('properties->status', ProcessStatus::QUEUED->value);
})->get();
foreach ($activities as $activity) {
$activity->properties->status = ProcessStatus::CANCELLED->value;
$activity->save();
}This matches the established pattern in the codebase for similar operations.
| Activity::where('properties->type_uuid', $service->uuid) | |
| ->where(function ($q) { | |
| $q->where('properties->status', ProcessStatus::IN_PROGRESS->value) | |
| ->orWhere('properties->status', ProcessStatus::QUEUED->value); | |
| }) | |
| ->each(function ($activity) { | |
| $activity->properties = $activity->properties->put('status', ProcessStatus::CANCELLED->value); | |
| $activity->save(); | |
| }); | |
| $activities = Activity::where('properties->type_uuid', $service->uuid) | |
| ->where(function ($q) { | |
| $q->where('properties->status', ProcessStatus::IN_PROGRESS->value) | |
| ->orWhere('properties->status', ProcessStatus::QUEUED->value); | |
| }) | |
| ->get(); | |
| foreach ($activities as $activity) { | |
| $activity->properties = $activity->properties->put('status', ProcessStatus::CANCELLED->value); | |
| $activity->save(); | |
| } |
Changes
forceDeploy()methodHow to Test