From 79b46f434d0ea48efaa0be0bf12cb8bc22496120 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Mon, 1 Mar 2021 17:30:22 +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/Abstracts/BaseApplication.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/System/Abstracts/BaseApplication.php b/System/Abstracts/BaseApplication.php index 2cb8bde1..2d1d88e5 100644 --- a/System/Abstracts/BaseApplication.php +++ b/System/Abstracts/BaseApplication.php @@ -108,6 +108,7 @@ abstract class BaseApplication extends Service /** * @return $this + * @throws ComponentException */ public function decrement(): static { @@ -116,14 +117,23 @@ abstract class BaseApplication extends Service $this->taskNumber = 0; $this->state = 'SWOOLE_WORKER_IDLE'; } - var_dump(Snowflake::getEnvironmental() . ':' . env('worker')); - var_dump($this->taskNumber, $this->state); + return $this->print_task_is_idle(); + } + + + /** + * @throws ComponentException + */ + private function print_task_is_idle(): static + { + $this->debug(sprintf('%s:%d state %s has number %d', Snowflake::getEnvironmental(), env('worker'), $this->state, $this->taskNumber)); return $this; } /** * @return $this + * @throws ComponentException */ public function increment(): static { @@ -134,9 +144,7 @@ abstract class BaseApplication extends Service } else { $this->state = 'SWOOLE_WORKER_BUSY'; } - var_dump(Snowflake::getEnvironmental() . ':' . env('worker')); - var_dump($this->taskNumber, $this->state); - return $this; + return $this->print_task_is_idle(); }