fix: Remove timeout from elastic rebuild wait logic

Previously the command would timeout after 600 seconds (10 minutes)
per model when using --wait flag. This was insufficient for large
datasets and could cause queue congestion.

Changes:
- Removed $maxWaitSeconds = 600 limitation
- Changed while condition from timeout check to infinite loop
- Removed timeout warning code
- Command now waits indefinitely until jobs complete
- Still exits early when jobs detected as complete
- Still exits on exception after 10 second delay

Behavior:
- Command will run until all jobs complete or exception occurs
- Can be manually killed with Ctrl+C if needed
- Better for production with large datasets (25k+ records)
This commit is contained in:
David Bomba 2025-11-26 02:32:30 +00:00
parent d27b3ffc47
commit 0d44ca6481
1 changed files with 1 additions and 9 deletions

View File

@ -335,12 +335,11 @@ class RebuildElasticIndexes extends Command
$this->line(" Waiting for our {$expectedJobCount} jobs to complete..."); $this->line(" Waiting for our {$expectedJobCount} jobs to complete...");
$this->line(" (Tracking: pending + processing jobs)", 'comment'); $this->line(" (Tracking: pending + processing jobs)", 'comment');
$maxWaitSeconds = 600;
$startTime = time(); $startTime = time();
$lastReportedDelta = -1; $lastReportedDelta = -1;
$stableCount = 0; $stableCount = 0;
while ((time() - $startTime) < $maxWaitSeconds) { while (true) {
try { try {
$currentJobCount = $this->getTotalActiveJobCount($connection, $queueName); $currentJobCount = $this->getTotalActiveJobCount($connection, $queueName);
$delta = $currentJobCount - $baselineJobCount; $delta = $currentJobCount - $baselineJobCount;
@ -371,13 +370,6 @@ class RebuildElasticIndexes extends Command
return; return;
} }
} }
try {
$finalCount = $this->getTotalActiveJobCount($connection, $queueName);
$this->warn(" ⚠ Timeout after {$maxWaitSeconds}s (active: {$finalCount}, baseline: {$baselineJobCount})");
} catch (\Exception $e) {
$this->warn(" ⚠ Timeout after {$maxWaitSeconds}s - continuing");
}
} }
protected function getTotalActiveJobCount(string $connection, string $queueName): int protected function getTotalActiveJobCount(string $connection, string $queueName): int