diff --git a/System/Abstracts/Pool.php b/System/Abstracts/Pool.php index 23158f78..8225edcb 100644 --- a/System/Abstracts/Pool.php +++ b/System/Abstracts/Pool.php @@ -49,12 +49,12 @@ abstract class Pool extends Component } - /** - * @param $name - * @param array $callback - * @return array - * @throws Exception - */ + /** + * @param $name + * @param array $callback + * @return array + * @throws Exception + */ protected function get($name, array $callback): mixed { if (!Context::inCoroutine()) { @@ -179,6 +179,9 @@ abstract class Pool extends Component if (!Context::inCoroutine()) { return; } + if (!isset($this->_items[$name])) { + $this->_items[$name] = new Channel($this->max); + } if (!$this->_items[$name]->isFull()) { $this->_items[$name]->push($client); } diff --git a/System/Pool/ObjectPool.php b/System/Pool/ObjectPool.php index 622d5441..b1682c3a 100644 --- a/System/Pool/ObjectPool.php +++ b/System/Pool/ObjectPool.php @@ -26,6 +26,7 @@ class ObjectPool extends \Snowflake\Abstracts\Pool public function getConnection(array $config, bool $isMaster): mixed { $config[0] = md5($config[0]); + $this->max = 100; return $this->get($config[0], $config); }