Optimize telescope table when pruning
continuous-integration/drone/push Build is failing Details

This commit is contained in:
philipp lang 2024-07-04 00:45:55 +02:00
parent 5661d66770
commit fc70107aa3
2 changed files with 26 additions and 2 deletions

View File

@ -0,0 +1,23 @@
<?php
namespace App\Actions;
use DB;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Http;
use Laravel\Telescope\Console\PruneCommand;
use Lorisleiva\Actions\Concerns\AsAction;
class DbMaintainAction
{
use AsAction;
public string $commandSignature = 'db:maintain';
public function handle()
{
Artisan::call(PruneCommand::class, ['--hours' => 168]); // 168h = 7 Tage
DB::select('optimize table telescope_entries');
Http::post('https://zoomyboy.de/maintain');
}
}

View File

@ -2,11 +2,11 @@
namespace App\Console; namespace App\Console;
use App\Actions\DbMaintainAction;
use App\Initialize\InitializeMembers; use App\Initialize\InitializeMembers;
use App\Invoice\Actions\InvoiceSendAction; use App\Invoice\Actions\InvoiceSendAction;
use Illuminate\Console\Scheduling\Schedule; use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel; use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Laravel\Telescope\Console\PruneCommand;
class Kernel extends ConsoleKernel class Kernel extends ConsoleKernel
{ {
@ -18,6 +18,7 @@ class Kernel extends ConsoleKernel
protected $commands = [ protected $commands = [
InvoiceSendAction::class, InvoiceSendAction::class,
InitializeMembers::class, InitializeMembers::class,
DbMaintainAction::class,
]; ];
/** /**
@ -27,7 +28,7 @@ class Kernel extends ConsoleKernel
*/ */
protected function schedule(Schedule $schedule) protected function schedule(Schedule $schedule)
{ {
$schedule->command(PruneCommand::class, ['--hours' => 168])->daily(); // 168h = 7 Tage $schedule->command(DbMaintainAction::class)->daily();
$schedule->command(InitializeMembers::class)->dailyAt('03:00'); $schedule->command(InitializeMembers::class)->dailyAt('03:00');
} }