feat: always sync full 24 months horizon of contingents

This commit is contained in:
Björn Fromme
2026-08-20 12:03:21 +02:00
parent 351fbab498
commit c1f0cda479
6 changed files with 41 additions and 42 deletions
+8 -6
View File
@@ -26,7 +26,9 @@ use Symfony\Component\Console\Style\SymfonyStyle;
/**
* Console entrypoint for the scheduled contingent snapshot sync.
*
* Runs at two cadences: a short horizon frequently, the full horizon a couple of times a day.
* Scheduled over the full horizon throughout: every 15 minutes during peak hours, hourly
* outside them. The options exist for ad-hoc runs — a narrower --horizon-months, or --hotel
* to re-sync a single accommodation while debugging.
*/
class BpnSyncContingentsCommand extends Command
{
@@ -48,7 +50,7 @@ class BpnSyncContingentsCommand extends Command
protected function configure(): void
{
$this
->addOption('horizon-months', null, InputOption::VALUE_REQUIRED, 'How many months ahead to sync', '24')
->addOption('horizon-months', null, InputOption::VALUE_REQUIRED, 'How many months ahead to sync (defaults to the full horizon)', '24')
->addOption('hotel', null, InputOption::VALUE_REQUIRED, 'Restrict the run to a single calendarCode')
->addOption('stale-after', null, InputOption::VALUE_REQUIRED, 'Minimum minutes since the last sync before an accommodation is eligible (ignored with --force)', '0')
->addOption('force', 'f', InputOption::VALUE_NONE, 'Sync even if the snapshot was refreshed recently')
@@ -148,10 +150,10 @@ class BpnSyncContingentsCommand extends Command
// Only a *total* failure is worth failing the task over: that means upstream is down or
// the API key is rejected, and the scheduler's failure mail is genuinely actionable.
// A single hotel breaking must stay quiet — this task runs every 15 minutes, so failing
// on it would mail dozens of times a day until someone silenced the task. That hotel is
// not lost track of: its own calendar serves a 502, and contingent_sync_state records
// failure_count and last_error.
// A single hotel breaking must stay quiet — this task runs every 15 minutes during the
// day, so failing on it would mail dozens of times a day until someone silenced the task.
// That hotel is not lost track of: its own calendar serves a 502, and
// contingent_sync_state records failure_count and last_error.
return $processed > 0 && $failed === $processed ? Command::FAILURE : Command::SUCCESS;
}