diff --git a/Connection.php b/Connection.php index b369818..bb5fad3 100644 --- a/Connection.php +++ b/Connection.php @@ -49,6 +49,9 @@ class Connection extends Component public int $connect_timeout = 30; + + public int $waite_time = 3; + public int $idle_time = 600; public array $pool = ['max' => 10, 'min' => 1]; @@ -150,7 +153,7 @@ class Connection extends Component */ protected function getNormalClientHealth(): PDO { - [$client, $time] = $this->pool()->get($this->cds); + [$client, $time] = $this->pool()->get($this->cds, $this->waite_time); if ((time() - $time) < $this->idle_time || $this->canUse($client)) { return $client; diff --git a/DatabasesProviders.php b/DatabasesProviders.php index 04a1061..ddabb97 100644 --- a/DatabasesProviders.php +++ b/DatabasesProviders.php @@ -65,6 +65,7 @@ class DatabasesProviders extends Providers 'database' => $database['database'], 'connect_timeout' => $database['connect_timeout'] ?? 10, 'idle_time' => $database['idle_time'] ?? 300, + 'waite_time' => $database['waite_time'] ?? 3, 'pool' => $clientPool, 'attributes' => $database['attributes'] ?? [], 'charset' => $database['charset'] ?? 'utf8mb4'