This commit is contained in:
as2252258@163.com
2021-02-28 00:41:22 +08:00
parent be1313cd4e
commit 69a8ad32cf
2 changed files with 8 additions and 6 deletions
+8 -1
View File
@@ -3,13 +3,14 @@ declare(strict_types=1);
namespace HttpServer\Events; namespace HttpServer\Events;
use co;
use Exception; use Exception;
use HttpServer\Abstracts\Callback; use HttpServer\Abstracts\Callback;
use Snowflake\Abstracts\Config; use Snowflake\Abstracts\Config;
use Snowflake\Event; use Snowflake\Event;
use Snowflake\Exception\ConfigException; use Snowflake\Exception\ConfigException;
use Snowflake\Snowflake; use Snowflake\Snowflake;
use Swoole\Coroutine;
use Swoole\Server; use Swoole\Server;
/** /**
@@ -42,6 +43,12 @@ class OnWorkerStart extends Callback
swoole_set_process_name($get_name); swoole_set_process_name($get_name);
} }
$container['enable_deadlock_check'] = false;
$container['exit_condition'] = function () {
return Co::stats()['coroutine_num'] === 0;
};
Coroutine::set($container);
// $this->onSignal($server, $worker_id); // $this->onSignal($server, $worker_id);
if ($worker_id >= $server->setting['worker_num']) { if ($worker_id >= $server->setting['worker_num']) {
fire(Event::SERVER_TASK_START); fire(Event::SERVER_TASK_START);
-5
View File
@@ -216,11 +216,6 @@ class Server extends HttpService
return; return;
} }
Runtime::enableCoroutine(true, $this->_types); Runtime::enableCoroutine(true, $this->_types);
$container['enable_deadlock_check'] = false;
$container['exit_condition'] = function () {
return Co::stats()['coroutine_num'] === 0;
};
Coroutine::set($container);
} }