⚙️ feat(LpjServiceProvider): Konfigurasi scheduling otomatis untuk cleanup inspeksi
Menambahkan registrasi commands dan scheduling untuk cleanup data inspeksi dengan konfigurasi multi-server dan logging - Register 3 command cleanup: CleanupInspeksiDataCommand, CleanupSingleInspeksiCommand, dan CleanupInspeksiStatusCommand - Daily cleanup scheduling setiap jam 02:00 dengan opsi --force dan withoutOverlapping() - Weekly backup cleanup setiap minggu pukul 03:00 pada hari minggu - Multi-server support dengan onOneServer() untuk environment clustered - Background execution dengan runInBackground() untuk performa optimal - Dedicated logging ke storage/logs/cleanup-inspeksi.log dan cleanup-inspeksi-weekly.log - Service binding untuk BankDataService dengan dependency injection - Modular structure dengan namespace dan module path yang terorganisir
This commit is contained in:
@@ -32,25 +32,46 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register commands in the format of Command::class
|
* Register commands in the format of Command::class
|
||||||
*/
|
*/
|
||||||
protected function registerCommands()
|
protected function registerCommands()
|
||||||
: void
|
: void
|
||||||
{
|
{
|
||||||
// $this->commands([]);
|
$this->commands([
|
||||||
}
|
\Modules\Lpj\Console\Commands\CleanupInspeksiDataCommand::class,
|
||||||
|
\Modules\Lpj\Console\Commands\CleanupSingleInspeksiCommand::class,
|
||||||
|
\Modules\Lpj\Console\Commands\CleanupInspeksiStatusCommand::class,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register command Schedules.
|
* Register command Schedules.
|
||||||
*/
|
*/
|
||||||
protected function registerCommandSchedules()
|
protected function registerCommandSchedules()
|
||||||
: void
|
: void
|
||||||
{
|
{
|
||||||
// $this->app->booted(function () {
|
$this->app->booted(function () {
|
||||||
// $schedule = $this->app->make(Schedule::class);
|
$schedule = $this->app->make(\Illuminate\Console\Scheduling\Schedule::class);
|
||||||
// $schedule->command('inspire')->hourly();
|
|
||||||
// });
|
// Jalankan cleanup inspeksi setiap hari jam 2 pagi
|
||||||
}
|
$schedule->command('lpj:cleanup-inspeksi --force')
|
||||||
|
->dailyAt('02:00')
|
||||||
|
->withoutOverlapping()
|
||||||
|
->onOneServer()
|
||||||
|
->runInBackground()
|
||||||
|
->appendOutputTo(storage_path('logs/cleanup-inspeksi.log'));
|
||||||
|
|
||||||
|
// Backup cleanup setiap minggu
|
||||||
|
$schedule->command('lpj:cleanup-inspeksi --force')
|
||||||
|
->weekly()
|
||||||
|
->sundays()
|
||||||
|
->at('03:00')
|
||||||
|
->withoutOverlapping()
|
||||||
|
->onOneServer()
|
||||||
|
->runInBackground()
|
||||||
|
->appendOutputTo(storage_path('logs/cleanup-inspeksi-weekly.log'));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register translations.
|
* Register translations.
|
||||||
|
|||||||
Reference in New Issue
Block a user