改名
This commit is contained in:
@@ -2,14 +2,15 @@
|
|||||||
|
|
||||||
namespace Kiri\FileListen;
|
namespace Kiri\FileListen;
|
||||||
|
|
||||||
use Note\Inject;
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use Kiri\Abstracts\Config;
|
use Kiri\Abstracts\Config;
|
||||||
use Kiri\Error\Logger;
|
use Kiri\Error\Logger;
|
||||||
use Kiri\Exception\ConfigException;
|
use Kiri\Exception\ConfigException;
|
||||||
use Kiri\Kiri;
|
use Kiri\Kiri;
|
||||||
|
use Note\Inject;
|
||||||
use Swoole\Coroutine;
|
use Swoole\Coroutine;
|
||||||
use Swoole\Process;
|
use Swoole\Process;
|
||||||
|
use Swoole\Timer;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
@@ -81,7 +82,8 @@ class HotReload extends Command
|
|||||||
}
|
}
|
||||||
$this->trigger_reload();
|
$this->trigger_reload();
|
||||||
|
|
||||||
var_dump(getmypid());
|
Timer::tick(1000, fn() => $this->healthCheck());
|
||||||
|
|
||||||
Process::signal(SIGTERM, [$this, 'onSignal']);
|
Process::signal(SIGTERM, [$this, 'onSignal']);
|
||||||
Process::signal(SIGKILL, [$this, 'onSignal']);
|
Process::signal(SIGKILL, [$this, 'onSignal']);
|
||||||
|
|
||||||
@@ -90,6 +92,19 @@ class HotReload extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function healthCheck()
|
||||||
|
{
|
||||||
|
if ($this->process && !Process::kill($this->process->pid, 0)) {
|
||||||
|
echo 'service is shutdown you need reload.';
|
||||||
|
|
||||||
|
$this->trigger_reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $data
|
* @param $data
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
|
|||||||
Reference in New Issue
Block a user