Kaynağa Gözat

fix: keep answer analysis on scaled pdf workers

yemeishu 1 hafta önce
ebeveyn
işleme
d9429b13f3
2 değiştirilmiş dosya ile 8 ekleme ve 7 silme
  1. 3 3
      app/Jobs/ProcessExamAnswerAnalysisJob.php
  2. 5 4
      config/queue.php

+ 3 - 3
app/Jobs/ProcessExamAnswerAnalysisJob.php

@@ -27,9 +27,9 @@ class ProcessExamAnswerAnalysisJob implements ShouldQueue
         public string $taskId,
         public array $examData
     ) {
-        // This job computes and persists analysis data. Keep it off the PDF
-        // queue so report rendering can start as soon as analysis finishes.
-        $this->onQueue((string) config('queue.workloads.exam_answer_analysis', 'default'));
+        // Keep the default on the scaled worker fleet. In production today the
+        // PDF nodes are the only horizontally scaled queue consumers.
+        $this->onQueue((string) config('queue.workloads.exam_answer_analysis', 'pdf'));
         $this->afterCommit();
     }
 

+ 5 - 4
config/queue.php

@@ -20,15 +20,16 @@ return [
     | Workload Queue Names
     |--------------------------------------------------------------------------
     |
-    | Keep browser-visible PDF generation isolated from CPU/DB side work. The
-    | defaults match docker-compose.yml: math_cms_queue consumes "default",
-    | while math_cms_pdf consumes "pdf".
+    | Defaults match the current multi-server production topology: only the PDF
+    | worker fleet consumes "pdf" at scale, while the main server has one
+    | default worker. Move analysis to another queue only after deploying
+    | workers for that queue on the PDF/worker nodes.
     |
     */
 
     'workloads' => [
         'pdf' => env('QUEUE_PDF', 'pdf'),
-        'exam_answer_analysis' => env('QUEUE_EXAM_ANSWER_ANALYSIS', 'default'),
+        'exam_answer_analysis' => env('QUEUE_EXAM_ANSWER_ANALYSIS', 'pdf'),
         'question_difficulty_calibration' => env('QUEUE_QUESTION_DIFFICULTY_CALIBRATION', 'default'),
         'question_difficulty_calibration_delay_seconds' => (int) env('QUEUE_QUESTION_DIFFICULTY_CALIBRATION_DELAY_SECONDS', 30),
     ],