From 3c4c27df84889227bc483ddb019554a5f5abf503 Mon Sep 17 00:00:00 2001 From: zxin <14545600+NHZEX@users.noreply.github.com> Date: Thu, 28 Mar 2024 15:49:47 +0800 Subject: [PATCH] =?UTF-8?q?Update:=20=E6=94=B9=E8=BF=9B=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=E4=B8=AD=E5=BF=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Components/connection-center/src/ConnectionCenter.php | 2 +- .../connection-center/src/Contract/IConnection.php | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Components/connection-center/src/ConnectionCenter.php b/src/Components/connection-center/src/ConnectionCenter.php index 10b51b1004..d44a39ce72 100644 --- a/src/Components/connection-center/src/ConnectionCenter.php +++ b/src/Components/connection-center/src/ConnectionCenter.php @@ -98,7 +98,7 @@ public function getRequestContextConnection(string $name): IConnection } } } - if (null === $connection) + if (null === $connection || ConnectionStatus::Available !== $connection->getStatus()) { $connection = $this->getConnection($name); $requestContext[static::class][$name] = [ diff --git a/src/Components/connection-center/src/Contract/IConnection.php b/src/Components/connection-center/src/Contract/IConnection.php index 775e86d699..3b63fcee6c 100644 --- a/src/Components/connection-center/src/Contract/IConnection.php +++ b/src/Components/connection-center/src/Contract/IConnection.php @@ -9,8 +9,14 @@ */ use Imi\ConnectionCenter\Enum\ConnectionStatus; +/** + * @template T of object + */ interface IConnection { + /** + * @param T $instance + */ public function __construct(IConnectionManager $manager, object $instance); /** @@ -20,6 +26,8 @@ public function getManager(): IConnectionManager; /** * 获取连接资源管理的对象实例. + * + * @return T */ public function getInstance(): object;