瀏覽代碼

choose db queue if gather than 200 records to export

Alexander Musikhin 2 年之前
父節點
當前提交
7af964e385
共有 2 個文件被更改,包括 6 次插入1 次删除
  1. 6 1
      app/Http/Controllers/ExportController.php
  2. 二進制
      storage/templates/одиночный.docx

+ 6 - 1
app/Http/Controllers/ExportController.php

@@ -52,7 +52,12 @@ class ExportController extends Controller
 
 
         $filename = 'Наш_Двор_' . date('YmdHis') . '.docx';
-        GenerateDocxJob::dispatch($vars_for_template, count($products), $filename, $request->template);
+        if($products->count() > 200){
+            GenerateDocxJob::dispatch($vars_for_template, count($products), $filename, $request->template)->onConnection('database');
+        } else {
+            GenerateDocxJob::dispatch($vars_for_template, count($products), $filename, $request->template)->onConnection('sync');
+        }
+
 
         Log::notice('Created export job. Execution time: ' . microtime(true) - LARAVEL_START);
 

二進制
storage/templates/одиночный.docx