改名
This commit is contained in:
@@ -26,6 +26,8 @@ class OnWorkerStart extends Callback
|
|||||||
/** @var int 重启信号 */
|
/** @var int 重启信号 */
|
||||||
private int $signal = SIGUSR1 | SIGUSR2 | SIGKILL | SIGTERM;
|
private int $signal = SIGUSR1 | SIGUSR2 | SIGKILL | SIGTERM;
|
||||||
|
|
||||||
|
private int $hook = SWOOLE_HOOK_ALL | SWOOLE_HOOK_CURL | ~SWOOLE_HOOK_BLOCKING_FUNCTION;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Server $server
|
* @param Server $server
|
||||||
@@ -39,6 +41,8 @@ class OnWorkerStart extends Callback
|
|||||||
{
|
{
|
||||||
putenv('worker=' . $worker_id);
|
putenv('worker=' . $worker_id);
|
||||||
|
|
||||||
|
Runtime::enableCoroutine(true, $this->hook);
|
||||||
|
|
||||||
Coroutine::set(['enable_deadlock_check' => false]);
|
Coroutine::set(['enable_deadlock_check' => false]);
|
||||||
|
|
||||||
if ($worker_id >= $server->setting['worker_num']) {
|
if ($worker_id >= $server->setting['worker_num']) {
|
||||||
|
|||||||
@@ -144,8 +144,6 @@ class Server extends HttpService
|
|||||||
return 'ok';
|
return 'ok';
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->enableCoroutine();
|
|
||||||
|
|
||||||
return $baseServer->start();
|
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 ConfigException
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
|
|||||||
Reference in New Issue
Block a user