改名
This commit is contained in:
@@ -13,7 +13,6 @@ use Kiri\Events\EventDispatch;
|
|||||||
use Kiri\Exception\ConfigException;
|
use Kiri\Exception\ConfigException;
|
||||||
use Kiri\Rpc\RpcProvider;
|
use Kiri\Rpc\RpcProvider;
|
||||||
use Server\Events\OnShutdown;
|
use Server\Events\OnShutdown;
|
||||||
use Swoole\Runtime;
|
|
||||||
|
|
||||||
|
|
||||||
defined('PID_PATH') or define('PID_PATH', APP_PATH . 'storage/server.pid');
|
defined('PID_PATH') or define('PID_PATH', APP_PATH . 'storage/server.pid');
|
||||||
@@ -82,7 +81,6 @@ class Server extends HttpService
|
|||||||
foreach ($processes as $process) {
|
foreach ($processes as $process) {
|
||||||
$this->manager->addProcess($process);
|
$this->manager->addProcess($process);
|
||||||
}
|
}
|
||||||
// Runtime::enableCoroutine(true, SWOOLE_HOOK_ALL ^ SWOOLE_HOOK_BLOCKING_FUNCTION);
|
|
||||||
|
|
||||||
return $this->manager->getServer()->start();
|
return $this->manager->getServer()->start();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,14 +6,14 @@ namespace Server;
|
|||||||
|
|
||||||
use Annotation\Inject;
|
use Annotation\Inject;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
use Kiri\Abstracts\Config;
|
||||||
use Kiri\Events\EventProvider;
|
use Kiri\Events\EventProvider;
|
||||||
use Kiri\Exception\NotFindClassException;
|
|
||||||
use Kiri\Kiri;
|
use Kiri\Kiri;
|
||||||
use ReflectionException;
|
|
||||||
use Server\Events\OnBeforeWorkerStart;
|
use Server\Events\OnBeforeWorkerStart;
|
||||||
use Server\Events\OnWorkerStart;
|
use Server\Events\OnWorkerStart;
|
||||||
use Server\Worker\OnServerWorker;
|
use Server\Worker\OnServerWorker;
|
||||||
use Server\Worker\OnWorkerStart as WorkerDispatch;
|
use Server\Worker\OnWorkerStart as WorkerDispatch;
|
||||||
|
use Swoole\Runtime;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
@@ -70,6 +70,10 @@ class ServerCommand extends Command
|
|||||||
if ($input->getArgument('action') == 'stop') {
|
if ($input->getArgument('action') == 'stop') {
|
||||||
throw new Exception('shutdown success');
|
throw new Exception('shutdown success');
|
||||||
}
|
}
|
||||||
|
$enable_coroutine = Config::get('servers.settings.enable_coroutine', false);
|
||||||
|
if ($enable_coroutine === true) {
|
||||||
|
Runtime::enableCoroutine(true, SWOOLE_HOOK_ALL ^ SWOOLE_HOOK_BLOCKING_FUNCTION);
|
||||||
|
}
|
||||||
$this->generate_runtime_builder($manager);
|
$this->generate_runtime_builder($manager);
|
||||||
} catch (\Throwable $throwable) {
|
} catch (\Throwable $throwable) {
|
||||||
$output->write($throwable->getMessage());
|
$output->write($throwable->getMessage());
|
||||||
@@ -81,9 +85,6 @@ class ServerCommand extends Command
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $manager
|
* @param $manager
|
||||||
* @return void
|
|
||||||
* @throws NotFindClassException
|
|
||||||
* @throws ReflectionException
|
|
||||||
*/
|
*/
|
||||||
private function generate_runtime_builder($manager): void
|
private function generate_runtime_builder($manager): void
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user