This commit is contained in:
2023-12-12 10:56:42 +08:00
parent 3d89612a8e
commit 4ebb7e9686
8 changed files with 16 additions and 16 deletions
+6 -5
View File
@@ -45,7 +45,8 @@ class HotReload extends BaseProcess
*/
public function getName(): string
{
return '[' . \config('id', 'system-service') . '].hot.load'; // TODO: Change the autogenerated stub
// TODO: Change the autogenerated stub
return '[' . \config('id', 'system-service') . '].hot.load';
}
@@ -123,7 +124,7 @@ class HotReload extends BaseProcess
$this->watch(rtrim($dir, '/'));
}
Event::add($this->inotify, fn() => $this->check());
Event::cycle(fn() => function() {
Event::cycle(fn() => function () {
Event::dispatch();
}, true);
Event::wait();
@@ -204,7 +205,7 @@ class HotReload extends BaseProcess
*/
private function checkFile($value, $isReload): bool
{
$md5 = md5($value);
$md5 = md5($value);
$mTime = filectime($value);
if (!isset($this->md5Map[$md5])) {
if ($isReload) {
@@ -341,7 +342,7 @@ class HotReload extends BaseProcess
return FALSE;
}
$wd = @inotify_add_watch($this->inotify, $dir, IN_MODIFY | IN_DELETE | IN_CREATE | IN_MOVE);
$wd = @inotify_add_watch($this->inotify, $dir, IN_MODIFY | IN_DELETE | IN_CREATE | IN_MOVE);
$this->watchFiles[$dir] = $wd;
$files = scandir($dir);
@@ -358,7 +359,7 @@ class HotReload extends BaseProcess
//检测文件类型
if (strstr($f, '.') == '.php') {
$wd = @inotify_add_watch($this->inotify, $path, IN_MODIFY | IN_DELETE | IN_CREATE | IN_MOVE);
$wd = @inotify_add_watch($this->inotify, $path, IN_MODIFY | IN_DELETE | IN_CREATE | IN_MOVE);
$this->watchFiles[$path] = $wd;
}
}