变更
This commit is contained in:
@@ -50,10 +50,6 @@ class AsyncServer implements ServerInterface
|
|||||||
public function initCoreServers(array $service, int $daemon = 0): void
|
public function initCoreServers(array $service, int $daemon = 0): void
|
||||||
{
|
{
|
||||||
$service = $this->genConfigService($service);
|
$service = $this->genConfigService($service);
|
||||||
$pid = (int)file_get_contents(storage('.swoole.pid'));
|
|
||||||
if (posix_kill($pid, 0)) {
|
|
||||||
posix_kill($pid, SIGTERM);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->createBaseServer(array_shift($service), $daemon);
|
$this->createBaseServer(array_shift($service), $daemon);
|
||||||
foreach ($service as $value) {
|
foreach ($service as $value) {
|
||||||
|
|||||||
+4
-4
@@ -50,10 +50,11 @@ class HotReload extends Command
|
|||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
$this->startProcess();
|
$this->startProcess();
|
||||||
$signal = SIGINT | SIGQUIT | SIGTERM;
|
$bool = pcntl_signal(SIGINT | SIGQUIT | SIGTERM, function () {
|
||||||
$bool = Process::signal($signal, function () {
|
|
||||||
$this->stopProcess();
|
$this->stopProcess();
|
||||||
Process::wait();
|
|
||||||
|
$pid = (int)file_get_contents(storage('.swoole.pid'));
|
||||||
|
pcntl_waitpid($pid, $status);
|
||||||
});
|
});
|
||||||
echo 'Listen signal ' . ($bool ? 'success' : 'fail') . PHP_EOL;
|
echo 'Listen signal ' . ($bool ? 'success' : 'fail') . PHP_EOL;
|
||||||
if (extension_loaded('inotify')) {
|
if (extension_loaded('inotify')) {
|
||||||
@@ -61,7 +62,6 @@ class HotReload extends Command
|
|||||||
} else {
|
} else {
|
||||||
$this->onCrontabReload();
|
$this->onCrontabReload();
|
||||||
}
|
}
|
||||||
Process::wait();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user