This commit is contained in:
2021-11-05 00:12:13 +08:00
parent 8d98dc83be
commit 7d8c50aed8
+9 -6
View File
@@ -45,10 +45,11 @@ class Inotify
} }
/**
* 开始监听
* @throws Exception /**
*/ * 开始监听
*/
public function check() public function check()
{ {
if (!($events = inotify_read($this->inotify))) { if (!($events = inotify_read($this->inotify))) {
@@ -67,10 +68,12 @@ class Inotify
} }
//非重启类型 //非重启类型
if (str_ends_with($ev['name'], '.php')) { if (str_ends_with($ev['name'], '.php')) {
if ($this->process->isReloading) { if ($this->process->int !== -1) {
return; return;
} }
$this->reload(); $this->process->int = @swoole_timer_after(2000, [$this, 'reload']);
$this->process->isReloading = true;
} }
} }
} }