This commit is contained in:
2021-02-26 19:55:36 +08:00
parent 6e3ecce453
commit 4065d2c4dc
2 changed files with 3 additions and 2 deletions
+1
View File
@@ -65,6 +65,7 @@ class OnWorkerStart extends Callback
if ($sigkill === false) { if ($sigkill === false) {
return $server->stop($workerId); return $server->stop($workerId);
} }
var_dump(Snowflake::app()->isRun());
while (Snowflake::app()->isRun()) { while (Snowflake::app()->isRun()) {
Coroutine::sleep(0.01); Coroutine::sleep(0.01);
} }
+2 -2
View File
@@ -51,7 +51,7 @@ abstract class BaseApplication extends Service
use TraitApplication; use TraitApplication;
private string $state = ''; private string $state = 'SWOOLE_WORKER_IDLE';
private int $taskNumber = 0; private int $taskNumber = 0;
@@ -106,7 +106,7 @@ abstract class BaseApplication extends Service
public function increment() public function increment()
{ {
$this->taskNumber += 1; $this->taskNumber += 1;
if ($this->taskNumber <= 0) { if ($this->taskNumber <= 1) {
$this->taskNumber = 0; $this->taskNumber = 0;
$this->state = 'SWOOLE_WORKER_IDLE'; $this->state = 'SWOOLE_WORKER_IDLE';
} else { } else {