From 287dc993625eb01c1151656b27004ea8ad788178 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Fri, 17 Jun 2022 14:30:31 +0800 Subject: [PATCH] modify plugin name --- kiri-engine/Pool/Pool.php | 5 ++++- kiri-engine/Pool/SplQueue.php | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/kiri-engine/Pool/Pool.php b/kiri-engine/Pool/Pool.php index 26e3adbd..b7bc3f51 100644 --- a/kiri-engine/Pool/Pool.php +++ b/kiri-engine/Pool/Pool.php @@ -65,8 +65,11 @@ class Pool extends Component public function check($name): array { $channel = $this->channel($name); - $count = $success = 0; + if ($channel->length() < 1) { + return [0, 0]; + } + $count = $success = 0; $lists = []; while (($pdo = $channel->pop()) instanceof PDO) { $count += 1; diff --git a/kiri-engine/Pool/SplQueue.php b/kiri-engine/Pool/SplQueue.php index 08376f6f..3fbfba52 100644 --- a/kiri-engine/Pool/SplQueue.php +++ b/kiri-engine/Pool/SplQueue.php @@ -56,6 +56,9 @@ class SplQueue implements QueueInterface public function pop(float $timeout = -1): mixed { // TODO: Implement pop() method. + if ($this->channel->count() < 1) { + return null; + } return $this->channel->dequeue(); }