mysql 开启断线重连_[BUG反馈]MYSQL长连接中(SWOOLE) 使用事务提交开启断线重连接抛出异常...
官方源代碼
vendor/topthink/think-orm/src/db/PDOConnection.php :1369行public?function?startTrans():?void
{
$this->initConnect(true);
++$this->transTimes;
try?{
if?(1?==?$this->transTimes)?{
$this->linkID->beginTransaction();
}?elseif?($this->transTimes?>?1?&&?$this->supportSavepoint())?{
$this->linkID->exec(
$this->parseSavepoint('trans'?.?$this->transTimes)
);
}
$this->reConnectTimes?=?0;
}?catch?(\Exception?$e)?{
if?($this->reConnectTimes?isBreak($e))?{
--$this->transTimes;
++$this->reConnectTimes;
$this->close()->startTrans();
}
throw?$e;
}
}修復建議: 在"throw $e;"上面加個else或 使用return阻止拋出異常public?function?startTrans():?void
{
$this->initConnect(true);
++$this->transTimes;
try?{
if?(1?==?$this->transTimes)?{
$this->linkID->beginTransaction();
}?elseif?($this->transTimes?>?1?&&?$this->supportSavepoint())?{
$this->linkID->exec(
$this->parseSavepoint('trans'?.?$this->transTimes)
);
}
$this->reConnectTimes?=?0;
}?catch?(\Exception?$e)?{
if?($this->reConnectTimes?isBreak($e))?{
--$this->transTimes;
++$this->reConnectTimes;
$this->close()->startTrans();
}else{
throw?$e;
}
}
}
總結
以上是生活随笔為你收集整理的mysql 开启断线重连_[BUG反馈]MYSQL长连接中(SWOOLE) 使用事务提交开启断线重连接抛出异常...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 用python解决实际问题_Python
- 下一篇: gitlab更新配置无效_GitMast