From af5eefd617133bbfa9f7c6e3801d0fa9ce4ed61f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Mon, 1 Mar 2021 18:18:07 +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 | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/System/Abstracts/BaseApplication.php b/System/Abstracts/BaseApplication.php index 30ce6ef3..dbd44620 100644 --- a/System/Abstracts/BaseApplication.php +++ b/System/Abstracts/BaseApplication.php @@ -51,7 +51,7 @@ abstract class BaseApplication extends Service use TraitApplication; - private string $state = 'SWOOLE_WORKER_IDLE'; + private int $state = SWOOLE_WORKER_IDLE; private int $taskNumber = 0; @@ -91,7 +91,7 @@ abstract class BaseApplication extends Service public function isRun(): bool { $this->print_task_is_idle(__METHOD__); - return $this->state == 'SWOOLE_WORKER_BUSY'; + return $this->state == SWOOLE_WORKER_BUSY; } @@ -101,7 +101,7 @@ abstract class BaseApplication extends Service public function stateInit(): static { $this->taskNumber = 0; - $this->state = 'SWOOLE_WORKER_IDLE'; + $this->state = SWOOLE_WORKER_IDLE; return $this; } @@ -116,9 +116,9 @@ abstract class BaseApplication extends Service $this->taskNumber -= 1; if ($this->taskNumber <= 0) { $this->taskNumber = 0; - $this->state = 'SWOOLE_WORKER_IDLE'; + $this->state = SWOOLE_WORKER_IDLE; } else { - $this->state = 'SWOOLE_WORKER_BUSY'; + $this->state = SWOOLE_WORKER_BUSY; } return $this->print_task_is_idle(__METHOD__); } @@ -131,7 +131,7 @@ abstract class BaseApplication extends Service */ private function print_task_is_idle($method): static { - $this->warning(sprintf('%s %s:%d state %s has number %d', $method, Snowflake::getEnvironmental(), env('worker'), $this->state, $this->taskNumber)); + $this->warning(sprintf('%s %s:%d state %d has number %d', $method, Snowflake::getEnvironmental(), env('worker'), $this->state, $this->taskNumber)); return $this; } @@ -145,9 +145,9 @@ abstract class BaseApplication extends Service $this->taskNumber += 1; if ($this->taskNumber < 1) { $this->taskNumber = 0; - $this->state = 'SWOOLE_WORKER_IDLE'; + $this->state = SWOOLE_WORKER_IDLE; } else { - $this->state = 'SWOOLE_WORKER_BUSY'; + $this->state = SWOOLE_WORKER_BUSY; } return $this->print_task_is_idle(__METHOD__); }