From 4419b7b23731e42d78457044840d3531df16ba4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Fri, 17 Jun 2022 14:07:16 +0800 Subject: [PATCH] modify plugin name --- kiri-engine/Pool/Connection.php | 6 +++--- kiri-engine/Pool/Pool.php | 11 ++++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/kiri-engine/Pool/Connection.php b/kiri-engine/Pool/Connection.php index 498653b2..f8855b38 100644 --- a/kiri-engine/Pool/Connection.php +++ b/kiri-engine/Pool/Connection.php @@ -123,12 +123,12 @@ class Connection extends Component /** * @param string $name - * @return void + * @return array * @throws Kiri\Exception\ConfigException */ - public function check(string $name): void + public function check(string $name): array { - $this->pool->check($name); + return $this->pool->check($name); } diff --git a/kiri-engine/Pool/Pool.php b/kiri-engine/Pool/Pool.php index 886423bf..26e3adbd 100644 --- a/kiri-engine/Pool/Pool.php +++ b/kiri-engine/Pool/Pool.php @@ -59,21 +59,26 @@ class Pool extends Component /** * @param $name - * @return void + * @return array * @throws ConfigException */ - public function check($name): void + public function check($name): array { $channel = $this->channel($name); + $count = $success = 0; $lists = []; while (($pdo = $channel->pop()) instanceof PDO) { - $pdo->check(); + $count += 1; + if ($pdo->check()) { + $success += 1; + } $lists[] = $pdo; } foreach ($lists as $list) { $channel->push($list); } + return [$count, $success]; }