This commit is contained in:
2021-04-27 17:49:09 +08:00
parent 682d17deca
commit 2b2cd508d7
+10 -9
View File
@@ -168,15 +168,16 @@ abstract class Pool extends Component
if (!Context::inCoroutine()) {
return $this->createClient($name, $callback);
}
// if ($this->_items[$name]->length() > 10) {
// $connection = $this->_items[$name]->pop();
// if (!$this->checkCanUse($name, $connection)) {
// return $this->createClient($name, $callback);
// } else {
// return $connection;
// }
// }
return $this->createClient($name, $callback);
$channel = $this->_items[$name];
if ($channel->isEmpty()) {
return $this->createByCallback($name, $callback);
}
$connection = $channel->pop(0.002);
if (!$this->checkCanUse($name, $connection)) {
return $this->createClient($name, $callback);
} else {
return $connection;
}
}