From 300a016dd2d85b431fb7ae27d378f7d288be7992 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Thu, 5 Aug 2021 16:01:51 +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 --- Server/SInterface/PipeMessage.php | 11 ----------- System/Crontab/Crontab.php | 4 ++-- System/Crontab/CrontabInterface.php | 20 ++++++++++++++++++++ System/Crontab/DefaultCrontab.php | 2 +- 4 files changed, 23 insertions(+), 14 deletions(-) create mode 100644 System/Crontab/CrontabInterface.php diff --git a/Server/SInterface/PipeMessage.php b/Server/SInterface/PipeMessage.php index e8be03c8..f734d413 100644 --- a/Server/SInterface/PipeMessage.php +++ b/Server/SInterface/PipeMessage.php @@ -17,16 +17,5 @@ interface PipeMessage public function process(): void; - /** - * - */ - public function max_execute(): void; - - - /** - * @return bool - */ - public function isStop(): bool; - } diff --git a/System/Crontab/Crontab.php b/System/Crontab/Crontab.php index 6b4c274c..eef76959 100644 --- a/System/Crontab/Crontab.php +++ b/System/Crontab/Crontab.php @@ -16,7 +16,7 @@ use Swoole\Timer; * @package Snowflake * @property Application $application */ -abstract class Crontab implements PipeMessage +abstract class Crontab implements PipeMessage, CrontabInterface { const WAIT_END = 'crontab:wait:execute'; @@ -247,7 +247,7 @@ abstract class Crontab implements PipeMessage if (!$this->isMaxExecute()) { return 999; } - call_user_func([$this, 'max_execute']); + call_user_func([$this, 'onMaxExecute']); return $redis->del('crontab:' . $crontab_name); } catch (\Throwable $throwable) { return $this->application->addError($throwable, 'throwable'); diff --git a/System/Crontab/CrontabInterface.php b/System/Crontab/CrontabInterface.php new file mode 100644 index 00000000..418b1cb2 --- /dev/null +++ b/System/Crontab/CrontabInterface.php @@ -0,0 +1,20 @@ +