This commit is contained in:
2023-04-05 10:26:28 +08:00
parent c86eb1a83d
commit 732b922a4c
+11 -3
View File
@@ -151,11 +151,15 @@ class Connection extends Component
/** /**
* @return Mysql\PDO * @return Mysql\PDO
* @throws ConfigException * @throws Exception
*/ */
public function getMasterClient(): Mysql\PDO public function getMasterClient(): Mysql\PDO
{ {
return $this->connection->get($this->cds); $client = $this->connection->get($this->cds);
if ($client === false) {
throw new Exception('waite db client timeout.');
}
return $client;
} }
/** /**
@@ -164,7 +168,11 @@ class Connection extends Component
*/ */
public function getSlaveClient(): Mysql\PDO public function getSlaveClient(): Mysql\PDO
{ {
return $this->getMasterClient(); $client = $this->connection->get($this->cds);
if ($client === false) {
throw new Exception('waite db client timeout.');
}
return $client;
} }
/** /**