⚙️ 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:
Daeng Deni Mardaeni
2025-12-09 15:42:43 +07:00
parent 2c8136dcf3
commit 6378ba0f98

View File

@@ -32,25 +32,46 @@
}
/**
* Register commands in the format of Command::class
*/
protected function registerCommands()
: void
{
// $this->commands([]);
}
* Register commands in the format of Command::class
*/
protected function registerCommands()
: void
{
$this->commands([
\Modules\Lpj\Console\Commands\CleanupInspeksiDataCommand::class,
\Modules\Lpj\Console\Commands\CleanupSingleInspeksiCommand::class,
\Modules\Lpj\Console\Commands\CleanupInspeksiStatusCommand::class,
]);
}
/**
* Register command Schedules.
*/
protected function registerCommandSchedules()
: void
{
// $this->app->booted(function () {
// $schedule = $this->app->make(Schedule::class);
// $schedule->command('inspire')->hourly();
// });
}
* Register command Schedules.
*/
protected function registerCommandSchedules()
: void
{
$this->app->booted(function () {
$schedule = $this->app->make(\Illuminate\Console\Scheduling\Schedule::class);
// 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.