This commit is contained in:
xl
2022-05-03 06:56:28 +08:00
parent 6b276fd1c2
commit 273f7b3ee5
2 changed files with 186 additions and 3 deletions
+16 -3
View File
@@ -117,11 +117,11 @@ class Server extends HttpService
$reload = Config::get('reload.hot', false);
if ($reload !== false) {
$this->eventProvider->on(OnWorkerStart::class, [$this->router, 'scan_build_route']);
$this->eventProvider->on(OnWorkerStart::class, [$this, 'onWorkerStart']);
$this->process[] = Inotify::class;
$this->process[] = Scaner::class;
} else {
$this->router->scan_build_route();
$this->onWorkerStart();
}
$processes = array_merge($this->process, Config::get('processes', []));
@@ -134,6 +134,19 @@ class Server extends HttpService
}
/**
* @return void
* @throws ReflectionException
* @throws Exception
*/
public function onWorkerStart(): void
{
scan_directory(MODEL_PATH, 'app\Model');
$this->router->scan_build_route();
}
/**
* @return void
* @throws ConfigException