Merge remote-tracking branch 'origin/master'

# Conflicts:
#	kiri-engine/FileListen/HotReload.php
This commit is contained in:
2021-11-19 10:11:55 +08:00
2 changed files with 14 additions and 5 deletions
+3
View File
@@ -223,6 +223,7 @@ class Application extends BaseApplication
} }
/** /**
* @throws NotFindClassException * @throws NotFindClassException
* @throws ReflectionException * @throws ReflectionException
@@ -240,6 +241,8 @@ class Application extends BaseApplication
} }
/** /**
* @param $className * @param $className
* @param null $abstracts * @param null $abstracts
+11 -5
View File
@@ -47,13 +47,17 @@ class Inotify
public function clear() public function clear()
{ {
Event::del($this->inotify); Event::del($this->inotify);
var_dump('clear event');
Event::exit(); Event::exit();
} }
/** /**
* 开始监听 * 开始监听
*/ * @throws Exception
*/
public function check() public function check()
{ {
if (!($events = inotify_read($this->inotify))) { if (!($events = inotify_read($this->inotify))) {
@@ -75,7 +79,10 @@ class Inotify
if ($this->process->int !== -1) { if ($this->process->int !== -1) {
return; return;
} }
$this->process->int = @swoole_timer_after(2000, [$this, 'reload']);
usleep(200);
$this->reload();
$this->process->isReloading = true; $this->process->isReloading = true;
} }
@@ -151,7 +158,6 @@ class Inotify
} else if (!str_ends_with($f, '.php')) { } else if (!str_ends_with($f, '.php')) {
continue; continue;
} }
//检测文件类型 //检测文件类型
if (strstr($f, '.') == '.php') { if (strstr($f, '.') == '.php') {
$wd = @inotify_add_watch($this->inotify, $path, $this->events); $wd = @inotify_add_watch($this->inotify, $path, $this->events);