[更新]任务指令增加结束符,避免重复检查出错

This commit is contained in:
Anyon 2019-08-16 10:32:10 +08:00
parent b89781f8b5
commit 33e08fe564
5 changed files with 14 additions and 13 deletions

View File

@ -56,7 +56,7 @@ class Listen extends Task
foreach (Db::name('SystemQueue')->where([['status', 'eq', '1'], ['time', '<=', time()]])->order('time asc')->select() as $item) { foreach (Db::name('SystemQueue')->where([['status', 'eq', '1'], ['time', '<=', time()]])->order('time asc')->select() as $item) {
try { try {
Db::name('SystemQueue')->where(['id' => $item['id']])->update(['status' => '2', 'start_at' => date('Y-m-d H:i:s')]); Db::name('SystemQueue')->where(['id' => $item['id']])->update(['status' => '2', 'start_at' => date('Y-m-d H:i:s')]);
$this->cmd = "{$this->bin} xtask:_work {$item['id']}"; $this->cmd = "{$this->bin} xtask:_work {$item['id']} -";
if ($this->checkProcess()) { if ($this->checkProcess()) {
$output->comment("处理任务的子进程已经存在 --> [{$item['id']}] {$item['title']}"); $output->comment("处理任务的子进程已经存在 --> [{$item['id']}] {$item['title']}");
} else { } else {

View File

@ -51,6 +51,7 @@ class Work extends Task
// 执行任务配置 // 执行任务配置
$this->setName('xtask:_work')->setDescription('[执行]创建执行单个指定任务的进程'); $this->setName('xtask:_work')->setDescription('[执行]创建执行单个指定任务的进程');
$this->addArgument('id', Argument::OPTIONAL, '指定任务ID'); $this->addArgument('id', Argument::OPTIONAL, '指定任务ID');
$this->addArgument('sp', Argument::OPTIONAL, '指令结束符');
} }
/** /**

2
vendor/autoload.php vendored
View File

@ -4,4 +4,4 @@
require_once __DIR__ . '/composer/autoload_real.php'; require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInitfc0b7e90cab7332af0db11653021f1a3::getLoader(); return ComposerAutoloaderInitf4a8ef0e9a37763a2e0caa5f75189947::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer // autoload_real.php @generated by Composer
class ComposerAutoloaderInitfc0b7e90cab7332af0db11653021f1a3 class ComposerAutoloaderInitf4a8ef0e9a37763a2e0caa5f75189947
{ {
private static $loader; private static $loader;
@ -19,15 +19,15 @@ class ComposerAutoloaderInitfc0b7e90cab7332af0db11653021f1a3
return self::$loader; return self::$loader;
} }
spl_autoload_register(array('ComposerAutoloaderInitfc0b7e90cab7332af0db11653021f1a3', 'loadClassLoader'), true, true); spl_autoload_register(array('ComposerAutoloaderInitf4a8ef0e9a37763a2e0caa5f75189947', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(); self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInitfc0b7e90cab7332af0db11653021f1a3', 'loadClassLoader')); spl_autoload_unregister(array('ComposerAutoloaderInitf4a8ef0e9a37763a2e0caa5f75189947', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) { if ($useStaticLoader) {
require_once __DIR__ . '/autoload_static.php'; require_once __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInitfc0b7e90cab7332af0db11653021f1a3::getInitializer($loader)); call_user_func(\Composer\Autoload\ComposerStaticInitf4a8ef0e9a37763a2e0caa5f75189947::getInitializer($loader));
} else { } else {
$map = require __DIR__ . '/autoload_namespaces.php'; $map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) { foreach ($map as $namespace => $path) {
@ -48,19 +48,19 @@ class ComposerAutoloaderInitfc0b7e90cab7332af0db11653021f1a3
$loader->register(true); $loader->register(true);
if ($useStaticLoader) { if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInitfc0b7e90cab7332af0db11653021f1a3::$files; $includeFiles = Composer\Autoload\ComposerStaticInitf4a8ef0e9a37763a2e0caa5f75189947::$files;
} else { } else {
$includeFiles = require __DIR__ . '/autoload_files.php'; $includeFiles = require __DIR__ . '/autoload_files.php';
} }
foreach ($includeFiles as $fileIdentifier => $file) { foreach ($includeFiles as $fileIdentifier => $file) {
composerRequirefc0b7e90cab7332af0db11653021f1a3($fileIdentifier, $file); composerRequiref4a8ef0e9a37763a2e0caa5f75189947($fileIdentifier, $file);
} }
return $loader; return $loader;
} }
} }
function composerRequirefc0b7e90cab7332af0db11653021f1a3($fileIdentifier, $file) function composerRequiref4a8ef0e9a37763a2e0caa5f75189947($fileIdentifier, $file)
{ {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file; require $file;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload; namespace Composer\Autoload;
class ComposerStaticInitfc0b7e90cab7332af0db11653021f1a3 class ComposerStaticInitf4a8ef0e9a37763a2e0caa5f75189947
{ {
public static $files = array ( public static $files = array (
'841780ea2e1d6545ea3a253239d59c05' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/functions.php', '841780ea2e1d6545ea3a253239d59c05' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/functions.php',
@ -314,9 +314,9 @@ class ComposerStaticInitfc0b7e90cab7332af0db11653021f1a3
public static function getInitializer(ClassLoader $loader) public static function getInitializer(ClassLoader $loader)
{ {
return \Closure::bind(function () use ($loader) { return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInitfc0b7e90cab7332af0db11653021f1a3::$prefixLengthsPsr4; $loader->prefixLengthsPsr4 = ComposerStaticInitf4a8ef0e9a37763a2e0caa5f75189947::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitfc0b7e90cab7332af0db11653021f1a3::$prefixDirsPsr4; $loader->prefixDirsPsr4 = ComposerStaticInitf4a8ef0e9a37763a2e0caa5f75189947::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitfc0b7e90cab7332af0db11653021f1a3::$classMap; $loader->classMap = ComposerStaticInitf4a8ef0e9a37763a2e0caa5f75189947::$classMap;
}, null, ClassLoader::class); }, null, ClassLoader::class);
} }