onQueue(config('knowledgebase.queue.ingestion', 'default')); } public function handle(IngestionService $ingestionService): void { $version = DocumentVersion::with(['document.category'])->findOrFail($this->documentVersionId); Log::info("ProcessUploadedDocumentJob mula untuk version {$this->documentVersionId}"); $ingestionService->processDocumentVersion($version); Log::info("ProcessUploadedDocumentJob selesai untuk version {$this->documentVersionId}"); } public function failed(Throwable $exception): void { Log::error("ProcessUploadedDocumentJob GAGAL untuk version {$this->documentVersionId}", [ 'error' => $exception->getMessage(), 'trace' => $exception->getTraceAsString(), ]); // Kemaskini status ke failed dalam database $version = DocumentVersion::find($this->documentVersionId); if ($version) { $version->updateStatus( DocumentVersion::STATUS_FAILED, 'Job gagal: ' . $exception->getMessage() ); } } }