This commit is contained in:
2021-11-05 00:08:43 +08:00
parent 3adea33afe
commit 8d98dc83be
2 changed files with 7 additions and 10 deletions
@@ -57,7 +57,7 @@ class FileChangeCustomProcess extends Command
public function execute(InputInterface $input, OutputInterface $output): int public function execute(InputInterface $input, OutputInterface $output): int
{ {
// TODO: Implement onHandler() method. // TODO: Implement onHandler() method.
set_error_handler([$this, 'onErrorHandler']); // set_error_handler([$this, 'onErrorHandler']);
$this->dirs = Config::get('inotify', [APP_PATH . 'app']); $this->dirs = Config::get('inotify', [APP_PATH . 'app']);
if (!extension_loaded('inotify')) { if (!extension_loaded('inotify')) {
+3 -6
View File
@@ -45,10 +45,9 @@ class Inotify
} }
/** /**
* 开始监听 * 开始监听
* @throws Exception
*/ */
public function check() public function check()
{ {
@@ -68,12 +67,10 @@ class Inotify
} }
//非重启类型 //非重启类型
if (str_ends_with($ev['name'], '.php')) { if (str_ends_with($ev['name'], '.php')) {
if ($this->process->int !== -1) { if ($this->process->isReloading) {
return; return;
} }
$this->process->int = @swoole_timer_after(2000, [$this, 'reload']); $this->reload();
$this->process->isReloading = true;
} }
} }
} }