} catch (\Exception $e) {
Db::connection('plugin.admin.mysql')->reconnect(); // 重新连接数据库Log::channel('queue')->info('数据库连接已断开,正在重连...');
}
Admin::where('id', $data重现问题的步骤
结果,在实际的每天运行过程中都会报错:
2006 MySQL server has gone away
我最开始没有加入:
try {
// 检查数据库连接是否可用} catch (\Exception $e) {
Db::connection('plugin.admin.mysql')->reconnect(); // 重新连接数据库Log::channel('queue')->info('数据库连接已断开,正在重连...');
}
这串代码的时候,有时候他会减少掉,但有时候不会。