This commit is contained in:
xl
2024-09-04 10:51:16 +08:00
parent e6c051ad24
commit 90154ece54
3 changed files with 10 additions and 1 deletions
+2
View File
@@ -71,7 +71,9 @@ class AsyncServer extends Component implements ServerInterface
* @param array $service
* @param int $daemon
* @return array
* @throws ContainerExceptionInterface
* @throws NotFindClassException
* @throws NotFoundExceptionInterface
*/
private function createBaseServer(array $service, int $daemon = 0): array
{
+7
View File
@@ -125,6 +125,13 @@ abstract class AbstractProcess implements OnProcessInterface
{
$this->process = $process;
if ($this->enable_coroutine) {
Coroutine::set([
'enable_deadlock_check' => false,
'deadlock_check_disable_trace' => false,
'exit_condition' => function () {
return Coroutine::stats()['coroutine_num'] === 0;
}
]);
Coroutine::create(fn () => $this->coroutineWaitSignal());
} else {
pcntl_signal(SIGTERM, [$this, 'pointWaitSignal']);
+1 -1
View File
@@ -48,7 +48,7 @@ trait TraitProcess
private function genProcess(AbstractProcess $name): Process
{
return new Process(function (Process $process) use ($name) {
$process->name('[' . \config('id', 'system-service') . '].' . $name->getName());
$process->name('[' . \config('id', 'system-service') . '].' . $name->getName()) . '.' . $process->pid;
$name->onShutdown($process)->process($process);
},
$name->getRedirectStdinAndStdout(),