This commit is contained in:
2023-02-13 14:27:28 +08:00
parent 59e25c1648
commit ed24164680
2 changed files with 14 additions and 1 deletions
+3 -1
View File
@@ -157,7 +157,7 @@ class Command extends Component
return $result == 0 ? true : $result;
} catch (\PDOException|\Throwable $throwable) {
if (str_contains($throwable->getMessage(), 'MySQL server has gone away')) {
Context::remove('master:client');
$this->db->restore(true);
unset($pdo);
return $this->_execute();
@@ -187,6 +187,8 @@ class Command extends Component
return $statement;
} catch (\PDOException|\Throwable $throwable) {
if (str_contains($throwable->getMessage(), 'MySQL server has gone away')) {
$this->db->restore(false);
unset($pdo);
return $this->queryPrev($this->db->getSlaveClient());
}