From 8106602d155fa51c7db6976b46d8cf00b3c338c9 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 18 Jan 2024 14:47:17 +0100 Subject: [PATCH] Add CleanupQueue command to clean up Redis queue keys --- app/Console/Commands/CleanupQueue.php | 22 ++++++++++++++++++++++ app/Console/Commands/Emails.php | 4 ---- app/Console/Kernel.php | 1 + 3 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 app/Console/Commands/CleanupQueue.php diff --git a/app/Console/Commands/CleanupQueue.php b/app/Console/Commands/CleanupQueue.php new file mode 100644 index 000000000..ac6562e5d --- /dev/null +++ b/app/Console/Commands/CleanupQueue.php @@ -0,0 +1,22 @@ +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 821041002..86f317c96 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 50db6d681..16ad8c466 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) {