ComposerUpdate

This commit is contained in:
邹景立 2021-03-24 11:43:46 +08:00
parent 873d4df12e
commit faba38194b
3 changed files with 13 additions and 18 deletions

View File

@ -834,12 +834,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zoujingli/ThinkLibrary.git", "url": "https://github.com/zoujingli/ThinkLibrary.git",
"reference": "111780326730bce8f7103d09a97de741d23a8fc7" "reference": "385e86100c264130347432a65e765b67bcabbc10"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/111780326730bce8f7103d09a97de741d23a8fc7", "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/385e86100c264130347432a65e765b67bcabbc10",
"reference": "111780326730bce8f7103d09a97de741d23a8fc7", "reference": "385e86100c264130347432a65e765b67bcabbc10",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -856,7 +856,7 @@
"ext-mbstring": "*", "ext-mbstring": "*",
"topthink/framework": "^6.0" "topthink/framework": "^6.0"
}, },
"time": "2021-03-20T09:21:53+00:00", "time": "2021-03-24T02:12:51+00:00",
"type": "library", "type": "library",
"extra": { "extra": {
"think": { "think": {

2
vendor/services.php vendored
View File

@ -1,5 +1,5 @@
<?php <?php
// This file is automatically generated at:2021-03-23 18:47:37 // This file is automatically generated at:2021-03-24 11:43:36
declare (strict_types = 1); declare (strict_types = 1);
return array ( return array (
0 => 'think\\admin\\Library', 0 => 'think\\admin\\Library',

View File

@ -226,21 +226,19 @@ class Queue extends Command
/** /**
* 立即监听任务 * 立即监听任务
* @throws \Exception * @throws \think\db\exception\DbException
*/ */
protected function listenAction() protected function listenAction()
{ {
set_time_limit(0); set_time_limit(0);
ignore_user_abort(true);
$this->app->db->setLog(new NullLogger()); $this->app->db->setLog(new NullLogger());
$this->app->db->name($this->table)->count(); $this->app->db->name($this->table)->count();
if ($this->process->iswin()) {
$this->setProcessTitle("ThinkAdmin {$this->process->version()} Queue Listen");
}
$this->output->writeln("\tYou can exit with <info>`CTRL-C`</info>"); $this->output->writeln("\tYou can exit with <info>`CTRL-C`</info>");
$this->output->writeln('============== LISTENING =============='); $this->output->writeln('=============== LISTENING ===============');
while (true) { while (true) {
[$start, $where] = [microtime(true), [['status', '=', 1], ['exec_time', '<=', time()]]]; [$map, $start] = [[['status', '=', 1], ['exec_time', '<=', time()]], microtime(true)];
foreach ($this->app->db->name($this->table)->where($where)->order('exec_time asc')->cursor() as $vo) try { foreach ($this->app->db->name($this->table)->where($map)->order('exec_time asc')->cursor() as $vo) try {
$args = "xadmin:queue dorun {$vo['code']} -"; $args = "xadmin:queue dorun {$vo['code']} -";
$this->output->comment(">$ {$this->process->think($args)}"); $this->output->comment(">$ {$this->process->think($args)}");
if (count($this->process->thinkQuery($args)) > 0) { if (count($this->process->thinkQuery($args)) > 0) {
@ -261,11 +259,12 @@ class Queue extends Command
/** /**
* 执行指定的任务内容 * 执行指定的任务内容
* @throws \Exception * @throws \think\db\exception\DbException
*/ */
protected function doRunAction() protected function doRunAction()
{ {
set_time_limit(0); set_time_limit(0);
ignore_user_abort(true);
$this->code = trim($this->input->getArgument('code')); $this->code = trim($this->input->getArgument('code'));
if (empty($this->code)) { if (empty($this->code)) {
$this->output->error('Task number needs to be specified for task execution'); $this->output->error('Task number needs to be specified for task execution');
@ -281,10 +280,6 @@ class Queue extends Command
'outer_time' => 0, 'exec_pid' => getmypid(), 'exec_desc' => '', 'status' => 2, 'outer_time' => 0, 'exec_pid' => getmypid(), 'exec_desc' => '', 'status' => 2,
]); ]);
$this->queue->progress(2, '>>> 任务处理开始 <<<', 0); $this->queue->progress(2, '>>> 任务处理开始 <<<', 0);
// 设置进程标题
if ($this->process->iswin()) {
$this->setProcessTitle("ThinkAdmin {$this->process->version()} Queue - {$this->queue->title}");
}
// 执行任务内容 // 执行任务内容
defined('WorkQueueCall') or define('WorkQueueCall', true); defined('WorkQueueCall') or define('WorkQueueCall', true);
defined('WorkQueueCode') or define('WorkQueueCode', $this->code); defined('WorkQueueCode') or define('WorkQueueCode', $this->code);
@ -316,7 +311,7 @@ class Queue extends Command
* @param integer $status 任务状态 * @param integer $status 任务状态
* @param string $message 消息内容 * @param string $message 消息内容
* @param boolean $isSplit 是否分隔 * @param boolean $isSplit 是否分隔
* @throws \Exception * @throws \think\db\exception\DbException
*/ */
protected function updateQueue(int $status, string $message, bool $isSplit = true) protected function updateQueue(int $status, string $message, bool $isSplit = true)
{ {