modify
This commit is contained in:
@@ -49,12 +49,12 @@ abstract class Pool extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $name
|
* @param $name
|
||||||
* @param array $callback
|
* @param array $callback
|
||||||
* @return array
|
* @return array
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
protected function get($name, array $callback): mixed
|
protected function get($name, array $callback): mixed
|
||||||
{
|
{
|
||||||
if (!Context::inCoroutine()) {
|
if (!Context::inCoroutine()) {
|
||||||
@@ -179,6 +179,9 @@ abstract class Pool extends Component
|
|||||||
if (!Context::inCoroutine()) {
|
if (!Context::inCoroutine()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!isset($this->_items[$name])) {
|
||||||
|
$this->_items[$name] = new Channel($this->max);
|
||||||
|
}
|
||||||
if (!$this->_items[$name]->isFull()) {
|
if (!$this->_items[$name]->isFull()) {
|
||||||
$this->_items[$name]->push($client);
|
$this->_items[$name]->push($client);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ class ObjectPool extends \Snowflake\Abstracts\Pool
|
|||||||
public function getConnection(array $config, bool $isMaster): mixed
|
public function getConnection(array $config, bool $isMaster): mixed
|
||||||
{
|
{
|
||||||
$config[0] = md5($config[0]);
|
$config[0] = md5($config[0]);
|
||||||
|
$this->max = 100;
|
||||||
return $this->get($config[0], $config);
|
return $this->get($config[0], $config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user