Browse Source

[更新]修改系统任务时间

Anyon 5 years ago
parent
commit
31b8c89bfc

+ 1 - 1
application/admin/queue/task/Listen.php

@@ -68,7 +68,7 @@ class Listen extends Task
                     $output->error("创建处理任务的子进程失败 --> [{$item['id']}] {$item['title']},{$e->getMessage()}");
                 }
             }
-            sleep(3);
+            sleep(2);
         }
     }
 

+ 3 - 1
application/admin/queue/task/Query.php

@@ -43,7 +43,9 @@ class Query extends Task
     protected function execute(Input $input, Output $output)
     {
         $this->cmd = "{$this->bin} xtask:";
-        foreach ($this->queryProcess() as $item) {
+        if (count($this->queryProcess()) < 1) {
+            $output->writeln('没有查询到相关任务进程');
+        } else foreach ($this->queryProcess() as $item) {
             $output->writeln("{$item['pid']}\t'{$item['cmd']}'");
         }
     }

+ 4 - 3
application/admin/sys.php

@@ -85,9 +85,10 @@ if (!function_exists('sysqueue')) {
             throw new \think\Exception('该任务已经创建,请耐心等待处理完成!');
         }
         $result = Db::name('SystemQueue')->insert([
-            'title' => $title, 'preload' => $loade,
-            'data'  => json_encode($data, JSON_UNESCAPED_UNICODE),
-            'time'  => $later > 0 ? time() + $later : time(), 'double' => intval($double),
+            'title'  => $title, 'preload' => $loade,
+            'data'   => json_encode($data, JSON_UNESCAPED_UNICODE),
+            'time'   => ($later > 0 ? time() + $later : time()) - 3,
+            'double' => intval($double),
         ]);
         return $result !== false;
     }