modify plugin name

This commit is contained in:
2022-02-23 16:32:08 +08:00
parent 8824f711bb
commit 688b2381da
3 changed files with 14 additions and 9 deletions
+2 -2
View File
@@ -7,10 +7,10 @@ use Kiri\Core\Network;
use Kiri\Exception\ConfigException; use Kiri\Exception\ConfigException;
use Kiri; use Kiri;
use Kiri\Rpc\RpcManager; use Kiri\Rpc\RpcManager;
use Kiri\Annotation\Attribute; use Kiri\Annotation\AbstractAttribute;
use ReflectionException; use ReflectionException;
#[\Attribute(\Attribute::TARGET_CLASS)] class JsonRpc extends Attribute #[\Attribute(\Attribute::TARGET_CLASS)] class JsonRpc extends AbstractAttribute
{ {
+11 -6
View File
@@ -25,6 +25,7 @@ use Kiri\Server\Events\OnWorkerStart;
use Psr\Container\ContainerExceptionInterface; use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface; use Psr\Container\NotFoundExceptionInterface;
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ServerRequestInterface;
use ReflectionException;
use Swoole\Coroutine; use Swoole\Coroutine;
use Swoole\Coroutine\Channel; use Swoole\Coroutine\Channel;
use Swoole\Server; use Swoole\Server;
@@ -51,19 +52,23 @@ class RpcJsonp extends Component implements OnConnectInterface, OnReceiveInterfa
private int $timerId; private int $timerId;
/** /**
* * @return void
* @throws \Exception * @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/ */
public function init(): void public function init(): void
{ {
$this->getEventProvider()->on(OnBeforeShutdown::class, [$this, 'onBeforeShutdown']); $provider = $this->getEventProvider();
$provider->on(OnBeforeShutdown::class, [$this, 'onBeforeShutdown']);
scan_directory(APP_PATH . 'rpc', 'app\Rpc'); scan_directory(APP_PATH . 'rpc', 'app\Rpc');
$this->getEventProvider()->on(OnWorkerStart::class, [$this, 'consulWatches']); $provider->on(OnWorkerStart::class, [$this, 'consulWatches']);
$this->getEventProvider()->on(OnWorkerExit::class, [$this, 'onWorkerExit']); $provider->on(OnWorkerExit::class, [$this, 'onWorkerExit']);
$this->getEventProvider()->on(OnServerBeforeStart::class, [$this, 'register']); $provider->on(OnServerBeforeStart::class, [$this, 'register']);
$this->manager = Kiri::getDi()->get(RpcManager::class); $this->manager = Kiri::getDi()->get(RpcManager::class);
} }
+1 -1
View File
@@ -74,7 +74,7 @@ class RpcManager extends Component
$this->async($name); $this->async($name);
} }
} catch (\Throwable $throwable) { } catch (\Throwable $throwable) {
$this->logger()->error(error_trigger_format($throwable)); $this->logger->error(error_trigger_format($throwable));
} }
} }