Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix(command): enhance cleanup process for stuck application previews by adding force delete for trashed records

Andras Bacsai581b649cd72d
diff --git a/app/Console/Commands/CleanupStuckedResources.php b/app/Console/Commands/CleanupStuckedResources.php
index 81824675b3..0644f420f4 100644
--- a/app/Console/Commands/CleanupStuckedResources.php
+++ b/app/Console/Commands/CleanupStuckedResources.php
@@ -82,12 +82,21 @@ class CleanupStuckedResources extends Command
foreach ($applicationsPreviews as $applicationPreview) {
if (! data_get($applicationPreview, 'application')) {
echo "Deleting stuck application preview: {$applicationPreview->uuid}\n";
- $applicationPreview->delete();
+ $applicationPreview->forceDelete();
}
}
} catch (\Throwable $e) {
echo "Error in cleaning stuck application: {$e->getMessage()}\n";
}
+ try {
+ $applicationsPreviews = ApplicationPreview::withTrashed()->whereNotNull('deleted_at')->get();
+ foreach ($applicationsPreviews as $applicationPreview) {
+ echo "Deleting stuck application preview: {$applicationPreview->uuid}\n";
+ $applicationPreview->forceDelete();
+ }
+ } catch (\Throwable $e) {
+ echo "Error in cleaning stuck application: {$e->getMessage()}\n";
+ }
try {
$postgresqls = StandalonePostgresql::withTrashed()->whereNotNull('deleted_at')->get();
foreach ($postgresqls as $postgresql) {