From df76dcaa54c64e0253d12abcf147f02b03807a14 Mon Sep 17 00:00:00 2001 From: "as2252258@163.com" Date: Thu, 6 Apr 2023 23:00:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kiri-engine/Pool/PoolItem.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/kiri-engine/Pool/PoolItem.php b/kiri-engine/Pool/PoolItem.php index d622e497..c81b92c0 100644 --- a/kiri-engine/Pool/PoolItem.php +++ b/kiri-engine/Pool/PoolItem.php @@ -106,13 +106,10 @@ class PoolItem */ public function pop(int $waite = 10): mixed { - if (!$this->_items->isEmpty()) { + if ($this->_items->isEmpty()) { + return call_user_func($this->callback); + } else { return $this->_items->pop(); } - if ($this->created > $this->maxCreated) { - return $this->_items->pop($waite); - } - $this->created += 1; - return call_user_func($this->callback); } }