Skip to content

Commit

Permalink
修复跨进程变量共享启动时未正常挂起
Browse files Browse the repository at this point in the history
  • Loading branch information
Eno-CN authored Jul 17, 2024
1 parent 0c21a40 commit a94a87a
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ class SharedMemoryProcess extends BaseProcess
{
public function run(\Swoole\Process $process): void
{
$running = true;
\Imi\Event\Event::on('IMI.PROCESS.END', static function () use (&$running) {
$running = false;
}, ImiPriority::IMI_MAX);
$socketFile = Config::get('@app.swooleSharedMemory.socketFile');
if (null === $socketFile)
{
Expand All @@ -34,5 +38,10 @@ public function run(\Swoole\Process $process): void
]);
$server->run();
fwrite(\STDOUT, 'Process [sharedMemory] start' . \PHP_EOL);
/** @phpstan-ignore-next-line */
while ($running)
{
sleep(1);
}
}
}

0 comments on commit a94a87a

Please sign in to comment.