Forráskód Böngészése

快递信息同步 超时时间与任务可尝试的次数

ANG YU 4 éve
szülő
commit
84e52587f2

+ 4 - 1
app/Jobs/LogisticSFSync.php

@@ -12,6 +12,10 @@ use Illuminate\Queue\SerializesModels;
 
 class LogisticSFSync implements ShouldQueue
 {
+    public $tries = 2;
+
+    public $timeout = 10;
+
     use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
 
     public $logistic_number;
@@ -40,7 +44,6 @@ class LogisticSFSync implements ShouldQueue
      */
     public function handle()
     {
-        ini_set('max_execution_time', 60);
         LogService::log(LogisticSFSync::class, "{$this->logistic_number}-JOB-SF", '');
         $this->logisticSFService = app('LogisticSFService');
         $formedData = $this->logisticSFService->get([$this->logistic_number]);

+ 4 - 1
app/Jobs/LogisticYDSync.php

@@ -13,6 +13,10 @@ use Illuminate\Queue\SerializesModels;
 
 class LogisticYDSync implements ShouldQueue
 {
+    public $tries = 2;
+
+    public $timeout = 10;
+
     use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
     /**
      * @var $logisticYDService LogisticYDService
@@ -43,7 +47,6 @@ class LogisticYDSync implements ShouldQueue
      */
     public function handle()
     {
-        ini_set('max_execution_time', 60);
         LogService::log(LogisticYDSync::class, "{$this->logistic_number}-JOB-YD", '');
         $this->logisticYDService = app('LogisticYDService');
         //先订阅订单

+ 5 - 1
app/Jobs/LogisticYTOSync.php

@@ -14,7 +14,12 @@ use Illuminate\Queue\SerializesModels;
 
 class LogisticYTOSync implements ShouldQueue
 {
+    public $tries = 2;
+
+    public $timeout = 10;
+
     use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
+
     /**
      * @var $logisticYTOService LogisticYTOService
      * @var $orderPackageReceivedSyncService OrderPackageReceivedSyncService
@@ -43,7 +48,6 @@ class LogisticYTOSync implements ShouldQueue
      */
     public function handle()
     {
-        ini_set('max_execution_time', 60);
         LogService::log(LogisticYTOSync::class, "{$this->logistic_number}-JOB-YTO", '');
         $this->logisticYTOService = app('LogisticYTOService');
         $nativeResponse = $this->logisticYTOService->query($this->logistic_number);

+ 3 - 1
app/Jobs/LogisticZopSync.php

@@ -14,6 +14,9 @@ use Illuminate\Queue\SerializesModels;
 
 class LogisticZopSync implements ShouldQueue
 {
+    public $tries = 2;
+    public $timeout = 10;
+
     use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
 
     /**
@@ -48,7 +51,6 @@ class LogisticZopSync implements ShouldQueue
      */
     public function handle()
     {
-        ini_set('max_execution_time', 60);
         LogService::log(LogisticZopSync::class, "JOB-ZOP", $this->logistic_number);
         $logistic_zop_service = new LogisticZopService();
         $nativeResponse = $logistic_zop_service->query($this->logistic_number);