From 1e16803814c031031d4b565f7c5799007573cee4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Fri, 16 Apr 2021 10:18:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- System/Crontab/Crontab.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/System/Crontab/Crontab.php b/System/Crontab/Crontab.php index 8ce07afa..0a417e39 100644 --- a/System/Crontab/Crontab.php +++ b/System/Crontab/Crontab.php @@ -180,7 +180,7 @@ abstract class Crontab extends BaseObject /** * @throws Exception */ - private function recover() + private function recover(): bool { $redis = Snowflake::app()->getRedis(); if ($redis->exists('stop:crontab:' . $this->getName())) { @@ -191,6 +191,7 @@ abstract class Crontab extends BaseObject $tickTime = time() + $this->getTickTime(); $redis->zAdd(Producer::CRONTAB_KEY, $tickTime, $name); } + return true; } @@ -213,23 +214,22 @@ abstract class Crontab extends BaseObject } - /** - * @param $application - * @return bool|int - * @throws \Exception - */ - public function isRecover($application): bool|int + /** + * @return bool|int + * @throws Exception + */ + public function isRecover(): bool|int { try { $redis = Snowflake::app()->getRedis(); - if ($application->isExit()) { + if ($this->isExit()) { return $redis->del('crontab:' . $this->getName()); } - if ($application->isMaxExecute()) { - call_user_func([$application, 'max_execute'], ...$application->params); + if ($this->isMaxExecute()) { + call_user_func([$this, 'max_execute'], ...$this->getParams()); return $redis->del('crontab:' . $this->getName()); } else { - return $application->recover(); + return $this->recover(); } } catch (\Throwable $throwable) { return logger()->addError($throwable, 'throwable');