Revert "改名"

This reverts commit fdf58326
This commit is contained in:
2022-01-14 15:52:38 +08:00
parent 829c063700
commit c3a3551ba3
+7 -3
View File
@@ -6,10 +6,10 @@ namespace Kiri\Pool;
use Closure; use Closure;
use Database\Mysql\PDO; use Database\Mysql\PDO;
use Exception; use Exception;
use Kiri;
use Kiri\Abstracts\Component; use Kiri\Abstracts\Component;
use Kiri\Abstracts\Config; use Kiri\Abstracts\Config;
use Kiri\Context; use Kiri\Context;
use Kiri;
use Swoole\Error; use Swoole\Error;
use Throwable; use Throwable;
@@ -126,7 +126,11 @@ class Connection extends Component
*/ */
public function initConnections($name, $isMaster, $max) public function initConnections($name, $isMaster, $max)
{ {
$this->getPool()->initConnections($name, $isMaster, $max); $pool = $this->getPool();
$pool->initConnections($name, $isMaster, $max);
for ($i = 0; $i < $max; $i++) {
$pool->push($name, $this->create($name, []));
}
} }
@@ -184,7 +188,7 @@ class Connection extends Component
} else { } else {
$result = true; $result = true;
} }
} catch (Error | Throwable $exception) { } catch (Error|Throwable $exception) {
$result = $this->addError($exception, 'mysql'); $result = $this->addError($exception, 'mysql');
} finally { } finally {
return $result; return $result;