diff --git a/Inotify.php b/Inotify.php index adfc5f4..c9f8bf9 100644 --- a/Inotify.php +++ b/Inotify.php @@ -3,6 +3,7 @@ namespace Kiri\Server; use Exception; +use Kiri\Abstracts\Config; use Kiri\Annotation\Inject; use Kiri\Error\StdoutLoggerInterface; use Kiri\Server\Abstracts\BaseProcess; @@ -45,12 +46,29 @@ class Inotify extends BaseProcess set_error_handler([$this, 'error']); set_exception_handler([$this, 'error']); - $this->dirs = [CONTROLLER_PATH, MODEL_PATH, APP_PATH . 'routes', APP_PATH . 'vendor/game-worker']; + if (!extension_loaded('inotify')) { + $this->cid = Timer::tick(1000, function () { + + }); + return; + } + + $this->dirs = Config::get('inotify', []); $this->start(); } + public function onSigterm(): static + { + Timer::clear($this->cid); + + $this->isStop = true; + + return parent::onSigterm(); // TODO: Change the autogenerated stub + } + + /** * @return void */