🚀 مُصادَق: تحديث برمجي جديد 2026-05-03 13:19
This commit is contained in:
@@ -26,16 +26,24 @@ while ($keepRunning) {
|
||||
if ($job) {
|
||||
echo "[+] Processing job: {$job['type']} ({$job['id']})\n";
|
||||
try {
|
||||
// Process based on type
|
||||
// match($job['type']) { ... }
|
||||
$container = $app->getContainer();
|
||||
|
||||
switch($job['type']) {
|
||||
case 'invoice_extraction':
|
||||
$handler = $container->get(\Queue\Jobs\ExtractInvoiceJob::class);
|
||||
$handler->handle($job['payload']);
|
||||
break;
|
||||
|
||||
default:
|
||||
echo "[!] Unknown job type: {$job['type']}\n";
|
||||
}
|
||||
|
||||
echo "[✓] Job completed: {$job['id']}\n";
|
||||
} catch (\Throwable $e) {
|
||||
echo "[✗] Job failed: {$job['id']} - {$e->getMessage()}\n";
|
||||
// Handle retries or DLQ
|
||||
// In a real app, you'd handle retries or move to a failed_jobs table
|
||||
}
|
||||
} else {
|
||||
// Sleep if no jobs
|
||||
usleep(500000); // 0.5s
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user