From 5d424f126a25726b926c3ac2ec5bbb60aab3eae5 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 28 Jan 2020 23:13:27 -0700 Subject: [PATCH] Add FailedJob garbage collection --- app/Console/Commands/FailedJobGC.php | 49 ++++++++++++++++++++++++++++ app/Console/Kernel.php | 1 + 2 files changed, 50 insertions(+) create mode 100644 app/Console/Commands/FailedJobGC.php diff --git a/app/Console/Commands/FailedJobGC.php b/app/Console/Commands/FailedJobGC.php new file mode 100644 index 000000000..f48d49b84 --- /dev/null +++ b/app/Console/Commands/FailedJobGC.php @@ -0,0 +1,49 @@ +failed_at->lt(now()->subMonth())) { + $job->delete(); + } + } + }); + } +} diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 1e3364afc..046890e7a 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -31,6 +31,7 @@ class Kernel extends ConsoleKernel ->hourly(); $schedule->command('horizon:snapshot')->everyFiveMinutes(); $schedule->command('story:gc')->everyFiveMinutes(); + $schedule->command('gc:failedjobs')->daily(); } /**