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