|
@@ -163,8 +163,25 @@ for ($i = 0; $i < $process_count;$i++)
|
|
|
Log::record("main process start wait sub process....",Log::DEBUG);
|
|
|
while (true)
|
|
|
{
|
|
|
- if($status = Swoole\Process::wait(true)) {
|
|
|
+ if($status = Swoole\Process::wait(true))
|
|
|
+ {
|
|
|
+ $quit_pid = $status['pid'];
|
|
|
Log::record("Sub process #{$status['pid']} quit, code={$status['code']}, signal={$status['signal']}",Log::DEBUG);
|
|
|
+ foreach ($workers as $pid => $worker)
|
|
|
+ {
|
|
|
+ if($pid != $quit_pid) {
|
|
|
+ Swoole\Process::kill($pid, SIGTERM);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ foreach ($workers as $pid => $worker)
|
|
|
+ {
|
|
|
+ if($pid != $quit_pid && ($status = Swoole\Process::wait(true)))
|
|
|
+ {
|
|
|
+ Log::record("Graceful Recycled #{$status['pid']}, code={$status['code']}, signal={$status['signal']}",Log::DEBUG);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
}
|
|
|
else
|
|
|
{
|