onQueue(config('knowledgebase.queue.ingestion', 'default')); } public function handle(IngestionService $ingestionService, AuditService $auditService): void { $version = DocumentVersion::with(['document.category'])->findOrFail($this->documentVersionId); Log::info("ReindexDocumentJob mula untuk version {$this->documentVersionId}"); // Deactivate point lama dalam Qdrant $ingestionService->deactivateVersionInQdrant($version); // Padam chunk lama dari MySQL untuk reprocess $version->chunks()->delete(); // Reset status dan mula proses semula $version->update([ 'processing_status' => DocumentVersion::STATUS_PENDING, 'processing_error' => null, 'processing_completed_at' => null, ]); // Reprocess $ingestionService->processDocumentVersion($version); $auditService->documentReindexed($version->document, $version); Log::info("ReindexDocumentJob selesai untuk version {$this->documentVersionId}"); } public function failed(Throwable $exception): void { Log::error("ReindexDocumentJob GAGAL untuk version {$this->documentVersionId}", [ 'error' => $exception->getMessage(), ]); $version = DocumentVersion::find($this->documentVersionId); $version?->updateStatus( DocumentVersion::STATUS_FAILED, 'Reindex gagal: ' . $exception->getMessage() ); } }