This commit is contained in:
2021-02-23 18:51:37 +08:00
parent e3a30de978
commit 542ede24cb
+5 -4
View File
@@ -38,7 +38,11 @@ class ObjectPool extends \Snowflake\Abstracts\Pool
if (is_object($config)) { if (is_object($config)) {
return $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) public function release(string $name, mixed $object)
{ {
if (method_exists($object, 'clean')) {
$object->clean();
}
$this->push($name, $object); $this->push($name, $object);
} }