mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 12:30:49 +08:00
cleanup check
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Console;
|
||||
|
||||
use App\Jobs\CheckCleanup;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
@@ -37,6 +38,8 @@ class Kernel extends ConsoleKernel
|
||||
})->withoutOverlapping();
|
||||
$schedule->command('meilisearch:import')->weeklyOn(1, "03:00")->withoutOverlapping();
|
||||
$schedule->command('torrent:load_pieces_hash')->dailyAt("01:00")->withoutOverlapping();
|
||||
|
||||
$this->registerScheduleCleanup($schedule);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,4 +53,16 @@ class Kernel extends ConsoleKernel
|
||||
|
||||
require base_path('routes/console.php');
|
||||
}
|
||||
|
||||
private function registerScheduleCleanup(Schedule $schedule): void
|
||||
{
|
||||
$interval = get_setting("main.autoclean_interval_one");
|
||||
if (!$interval || $interval < 60) {
|
||||
$interval = 7200;
|
||||
}
|
||||
$interval = 60;
|
||||
$schedule->job(new CheckCleanup())
|
||||
->cron(sprintf("*/%d * * * *", intval($interval/60)))
|
||||
->withoutOverlapping();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user