This commit is contained in:
2021-11-19 10:20:49 +08:00
parent b98de03317
commit 8ec1a81ecd
+14 -4
View File
@@ -74,7 +74,20 @@ class HotReload extends Command
swoole_set_process_name('[' . Config::get('id', 'sw service.') . '].sw:wather'); swoole_set_process_name('[' . Config::get('id', 'sw service.') . '].sw:wather');
} }
$this->trigger_reload(); $this->trigger_reload();
Process::signal(SIGTERM | SIGKILL, function ($data) {
var_dump(getmypid());
Process::signal(SIGTERM, [$this, 'onSignal']);
Process::signal(SIGKILL, [$this, 'onSignal']);
$this->driver->start();
return 0;
}
public function onSignal($data)
{
var_dump($data); var_dump($data);
$this->driver->clear(); $this->driver->clear();
$pid = file_get_contents(storage('.swoole.pid')); $pid = file_get_contents(storage('.swoole.pid'));
@@ -85,9 +98,6 @@ class HotReload extends Command
echo "PID={$ret['pid']}\n"; echo "PID={$ret['pid']}\n";
sleep(1); sleep(1);
} }
});
$this->driver->start();
return 0;
} }