diff --git a/app/cron/process_batches.php b/app/cron/process_batches.php index 4f84cfe..42de271 100644 --- a/app/cron/process_batches.php +++ b/app/cron/process_batches.php @@ -132,20 +132,20 @@ try { $db->commit(); echo "Success: Created Invoice $invoiceId\n"; - // Send silent push update for progress - $stmt = $db->prepare("SELECT total_images, processed_images, uploaded_by FROM invoice_batches WHERE id = ?"); - $stmt->execute([$batchId]); - $currentBatch = $stmt->fetch(); - if ($currentBatch) { - $notifier = new NotificationService(); - $notifier->sendDataNotification($currentBatch['uploaded_by'], [ - 'type' => 'batch_progress', - 'batch_id' => $batchId, - 'processed' => $currentBatch['processed_images'], - 'total' => $currentBatch['total_images'] - ]); - } - + try { + // Send silent push update for progress + $stmt = $db->prepare("SELECT total_images, processed_images, uploaded_by FROM invoice_batches WHERE id = ?"); + $stmt->execute([$batchId]); + $currentBatch = $stmt->fetch(); + if ($currentBatch) { + $notifier = new NotificationService(); + $notifier->sendDataNotification($currentBatch['uploaded_by'], [ + 'type' => 'batch_progress', + 'batch_id' => $batchId, + 'processed' => $currentBatch['processed_images'], + 'total' => $currentBatch['total_images'] + ]); + } } catch (\Exception $pushErr) { echo "Push error: " . $pushErr->getMessage() . "\n"; }