This commit is contained in:
2021-03-02 13:59:57 +08:00
parent 5c7e0126a7
commit 92f09ae5fa
2 changed files with 4 additions and 13 deletions
+4
View File
@@ -26,6 +26,8 @@ class OnWorkerStart extends Callback
/** @var int 重启信号 */
private int $signal = SIGUSR1 | SIGUSR2 | SIGKILL | SIGTERM;
private int $hook = SWOOLE_HOOK_ALL | SWOOLE_HOOK_CURL | ~SWOOLE_HOOK_BLOCKING_FUNCTION;
/**
* @param Server $server
@@ -39,6 +41,8 @@ class OnWorkerStart extends Callback
{
putenv('worker=' . $worker_id);
Runtime::enableCoroutine(true, $this->hook);
Coroutine::set(['enable_deadlock_check' => false]);
if ($worker_id >= $server->setting['worker_num']) {
-13
View File
@@ -144,8 +144,6 @@ class Server extends HttpService
return 'ok';
}
$this->enableCoroutine();
return $baseServer->start();
}
@@ -205,17 +203,6 @@ class Server extends HttpService
}
/**
* @param bool $isEnable
*/
private function enableCoroutine($isEnable = true)
{
if ($isEnable === true) {
Runtime::enableCoroutine(true, SWOOLE_HOOK_ALL | SWOOLE_HOOK_CURL);
}
}
/**
* @throws ConfigException
* @throws Exception