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.

Add CleanupQueue command to clean up Redis queue keys

Andras Bacsai8106602d155f
diff --git a/app/Console/Commands/CleanupQueue.php b/app/Console/Commands/CleanupQueue.php
new file mode 100644
index 0000000000..ac6562e5d6
--- /dev/null
+++ b/app/Console/Commands/CleanupQueue.php
@@ -0,0 +1,22 @@
+<?php
+
+namespace App\Console\Commands;
+
+use Illuminate\Console\Command;
+use Illuminate\Support\Facades\Redis;
+
+class CleanupQueue extends Command
+{
+ protected $signature = 'cleanup:queue';
+ protected $description = 'Cleanup Queue';
+
+ public function handle()
+ {
+ $prefix = config('database.redis.options.prefix');
+ $keys = Redis::connection()->keys('*:laravel*');
+ foreach ($keys as $key) {
+ $keyWithoutPrefix = str_replace($prefix, '', $key);
+ Redis::connection()->del($keyWithoutPrefix);
+ }
+ }
+}
diff --git a/app/Console/Commands/Emails.php b/app/Console/Commands/Emails.php
index 821041002f..86f317c96f 100644
--- a/app/Console/Commands/Emails.php
+++ b/app/Console/Commands/Emails.php
@@ -9,8 +9,6 @@ use App\Models\ScheduledDatabaseBackup;
use App\Models\Server;
use App\Models\StandalonePostgresql;
use App\Models\Team;
-use App\Models\TeamInvitation;
-use App\Models\User;
use App\Models\Waitlist;
use App\Notifications\Application\DeploymentFailed;
use App\Notifications\Application\DeploymentSuccess;
@@ -18,13 +16,11 @@ use App\Notifications\Application\StatusChanged;
use App\Notifications\Database\BackupFailed;
use App\Notifications\Database\BackupSuccess;
use App\Notifications\Test;
-use App\Notifications\TransactionalEmails\InvitationLink;
use Exception;
use Illuminate\Console\Command;
use Illuminate\Mail\Message;
use Illuminate\Notifications\Messages\MailMessage;
use Mail;
-use Illuminate\Support\Str;
use function Laravel\Prompts\confirm;
use function Laravel\Prompts\select;
diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php
index 50db6d681c..16ad8c4665 100644
--- a/app/Console/Kernel.php
+++ b/app/Console/Kernel.php
@@ -46,6 +46,7 @@ class Kernel extends ConsoleKernel
$this->pull_helper_image($schedule);
$this->check_scheduled_tasks($schedule);
}
+ $schedule->command('cleanup:queue')->everyMinute()->onOneServer();
}
private function pull_helper_image($schedule)
{