eee
This commit is contained in:
+11
-5
@@ -5,6 +5,7 @@ namespace Kiri\Server\Abstracts;
|
||||
use Kiri\Di\Inject\Container;
|
||||
use Kiri\Server\ServerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Swoole\Event;
|
||||
use Swoole\Process;
|
||||
use Kiri\Server\Processes\AbstractProcess;
|
||||
|
||||
@@ -86,12 +87,17 @@ class HotReload extends AbstractProcess
|
||||
public function process(Process|null $process): void
|
||||
{
|
||||
$this->addListen();
|
||||
while (!$this->isStop()) {
|
||||
$read = inotify_read($this->pipe);
|
||||
if (!empty($read)) {
|
||||
$this->reload();
|
||||
Event::cycle(function (): void {
|
||||
if ($this->isStop()) {
|
||||
Event::del($this->pipe);
|
||||
} else {
|
||||
$read = inotify_read($this->pipe);
|
||||
if (!empty($read)) {
|
||||
$this->reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
Event::wait();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user