From aa3da9e0e142d83d37f9ed6a88b782663b31bb07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 23 Mar 2021 16:38:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Annotation/Rpc/RpcService.php | 6 ------ Rpc/Producer.php | 4 ++++ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Annotation/Rpc/RpcService.php b/Annotation/Rpc/RpcService.php index 0d22b138..d5588dd9 100644 --- a/Annotation/Rpc/RpcService.php +++ b/Annotation/Rpc/RpcService.php @@ -49,14 +49,8 @@ use Snowflake\Snowflake; */ public function execute(array $handler): mixed { - // TODO: Change the autogenerated stub - if ($handler[0] instanceof IProducer) { - $handler[0]->initClient(); - } - $rpc = Snowflake::app()->getRpc(); $rpc->addProducer($this->cmd, $handler, $this->config); - return parent::execute($handler); } diff --git a/Rpc/Producer.php b/Rpc/Producer.php index a89392a2..9b1d2250 100644 --- a/Rpc/Producer.php +++ b/Rpc/Producer.php @@ -42,6 +42,10 @@ class Producer extends Component $this->consumers[$name] = $handler[0]; $this->producers[$name] = $node; + + if ($handler[0] instanceof IProducer) { + $handler[0]->initClient(); + } }