改名
This commit is contained in:
@@ -50,12 +50,22 @@ class HotReload extends Command
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @throws ConfigException
|
||||||
|
* @throws \ReflectionException
|
||||||
*/
|
*/
|
||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
$this->setName('sw:wather')
|
$this->setName('sw:wather')->setDescription('server start');
|
||||||
->setDescription('server start');
|
$this->dirs = Config::get('inotify', [APP_PATH . 'app']);
|
||||||
|
swoole_async_set(['enable_coroutine' => false]);
|
||||||
|
if (!extension_loaded('inotify')) {
|
||||||
|
$this->driver = Kiri::getDi()->make(Scaner::class, [$this->dirs, $this]);
|
||||||
|
} else {
|
||||||
|
$this->driver = Kiri::getDi()->make(Inotify::class, [$this->dirs, $this]);
|
||||||
|
}
|
||||||
|
if (Kiri::getPlatform()->isLinux()) {
|
||||||
|
swoole_set_process_name('[' . Config::get('id', 'sw service.') . '].sw:wather');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -68,18 +78,6 @@ class HotReload extends Command
|
|||||||
*/
|
*/
|
||||||
public function execute(InputInterface $input, OutputInterface $output): int
|
public function execute(InputInterface $input, OutputInterface $output): int
|
||||||
{
|
{
|
||||||
// TODO: Implement onHandler() method.
|
|
||||||
set_error_handler([$this, 'onErrorHandler']);
|
|
||||||
$this->dirs = Config::get('inotify', [APP_PATH . 'app']);
|
|
||||||
swoole_async_set(['enable_coroutine' => false]);
|
|
||||||
if (!extension_loaded('inotify')) {
|
|
||||||
$this->driver = Kiri::getDi()->make(Scaner::class, [$this->dirs, $this]);
|
|
||||||
} else {
|
|
||||||
$this->driver = Kiri::getDi()->make(Inotify::class, [$this->dirs, $this]);
|
|
||||||
}
|
|
||||||
if (Kiri::getPlatform()->isLinux()) {
|
|
||||||
swoole_set_process_name('[' . Config::get('id', 'sw service.') . '].sw:wather');
|
|
||||||
}
|
|
||||||
$this->trigger_reload();
|
$this->trigger_reload();
|
||||||
|
|
||||||
Timer::tick(1000, fn() => $this->healthCheck());
|
Timer::tick(1000, fn() => $this->healthCheck());
|
||||||
@@ -132,22 +130,6 @@ class HotReload extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $code
|
|
||||||
* @param $message
|
|
||||||
* @param $file
|
|
||||||
* @param $line
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public function onErrorHandler($code, $message, $file, $line)
|
|
||||||
{
|
|
||||||
if (str_contains($message, 'The file descriptor is not an inotify instance')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
debug('Error:' . $message . ' at ' . $file . ':' . $line);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 重启
|
* 重启
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user