From 542ede24cbb4ea701d02a0bdb3077905b1ec539c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 23 Feb 2021 18:51:37 +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 --- System/Pool/ObjectPool.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/System/Pool/ObjectPool.php b/System/Pool/ObjectPool.php index 7c320a38..5e5dd6a7 100644 --- a/System/Pool/ObjectPool.php +++ b/System/Pool/ObjectPool.php @@ -38,7 +38,11 @@ class ObjectPool extends \Snowflake\Abstracts\Pool if (is_object($config)) { return $config; } - return $this->getFromChannel($name = md5($config), [$config, $construct]); + $object = $this->getFromChannel($name = md5($config), [$config, $construct]); + if (method_exists($object, 'clean')) { + $object->clean(); + } + return $object; } @@ -61,9 +65,6 @@ class ObjectPool extends \Snowflake\Abstracts\Pool */ public function release(string $name, mixed $object) { - if (method_exists($object, 'clean')) { - $object->clean(); - } $this->push($name, $object); }