This commit is contained in:
2021-08-13 14:58:58 +08:00
parent 15851ba97c
commit 2432b98be5
13 changed files with 90 additions and 151 deletions
+5 -7
View File
@@ -5,9 +5,7 @@ namespace Annotation;
use Exception;
use Kiri\Exception\ComponentException;
use Kiri\Kiri;
use Kiri\Event as SEvent;
use Kiri\Events\EventProvider;
/**
@@ -34,10 +32,10 @@ use Kiri\Event as SEvent;
* @return bool
* @throws Exception
*/
public function execute(mixed $class, mixed $method = null): bool
{
// TODO: Implement execute() method.
SEvent::on($this->name, [$class, $method]);
public function execute(mixed $class, mixed $method = null): bool
{
$pro = di(EventProvider::class);
$pro->on($this->name, [$class, $method]);
return true;
}
+6 -3
View File
@@ -6,7 +6,9 @@ namespace Annotation;
use Exception;
use Kiri\Event;
use Kiri\Events\EventProvider;
use Kiri\Kiri;
use Server\Events\OnWorkerExit;
/**
* Class LocalService
@@ -28,9 +30,10 @@ use Kiri\Kiri;
if ($this->async_reload !== true) {
return;
}
Event::on(Event::SERVER_WORKER_EXIT, function () {
Kiri::app()->remove($this->service);
});
$pro = di(EventProvider::class);
$pro->on(OnWorkerExit::class, function () {
di(\Kiri\Di\LocalService::class)->remove($this->service);
},0);
}