eee
This commit is contained in:
+7
-7
@@ -37,9 +37,9 @@ class HotReload extends BaseProcess
|
||||
/**
|
||||
* @param Router $router
|
||||
*/
|
||||
public function __construct(public Router $router)
|
||||
public function __construct(Router $router)
|
||||
{
|
||||
on(OnWorkerStart::class, [$this->router, 'scan_build_route']);
|
||||
on(OnWorkerStart::class, [$router, 'scan_build_route']);
|
||||
|
||||
$this->forceFile = \config('reload.forceFile', false);
|
||||
}
|
||||
@@ -61,7 +61,7 @@ class HotReload extends BaseProcess
|
||||
{
|
||||
// TODO: Implement onSigterm() method.
|
||||
if (Context::inCoroutine()) {
|
||||
Coroutine::create(fn() => $this->onShutdown(Coroutine::waitSignal(SIGTERM | SIGINT)));
|
||||
Coroutine::create(fn () => $this->onShutdown(Coroutine::waitSignal(SIGTERM | SIGINT)));
|
||||
} else {
|
||||
\pcntl_signal(SIGTERM, [$this, 'onStop']);
|
||||
}
|
||||
@@ -127,8 +127,8 @@ class HotReload extends BaseProcess
|
||||
}
|
||||
$this->watch(rtrim($dir, '/'));
|
||||
}
|
||||
Event::add($this->inotify, fn() => $this->check());
|
||||
Event::cycle(fn() => function () {
|
||||
Event::add($this->inotify, fn () => $this->check());
|
||||
Event::cycle(fn () => function () {
|
||||
Event::dispatch();
|
||||
}, true);
|
||||
Event::wait();
|
||||
@@ -262,7 +262,7 @@ class HotReload extends BaseProcess
|
||||
if (Context::exists('swoole_timer_after')) {
|
||||
return;
|
||||
}
|
||||
$int = @swoole_timer_after(2000, fn() => $this->reload());
|
||||
$int = @swoole_timer_after(2000, fn () => $this->reload());
|
||||
Context::set('swoole_timer_after', $int);
|
||||
Context::set('isReloading', true);
|
||||
}
|
||||
@@ -308,7 +308,7 @@ class HotReload extends BaseProcess
|
||||
*/
|
||||
public function trigger_reload(): void
|
||||
{
|
||||
$this->logger->failure('Wait trigger server Reload' . PHP_EOL);
|
||||
\Kiri::getLogger()->failure('Wait trigger server Reload' . PHP_EOL);
|
||||
di(ServerInterface::class)->reload(false);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user