modify
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user