mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-14 01:29:07 +00:00
fix(Core/Shared/DB): recommit transactions on dead-lock error (#6069)
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Transaction.h"
|
||||
|
||||
#include <mysqld_error.h>
|
||||
|
||||
//- Append a raw ad-hoc query to the transaction
|
||||
void Transaction::Append(const char* sql)
|
||||
{
|
||||
@@ -63,14 +65,15 @@ void Transaction::Cleanup()
|
||||
|
||||
bool TransactionTask::Execute()
|
||||
{
|
||||
if (m_conn->ExecuteTransaction(m_trans))
|
||||
int errorCode = m_conn->ExecuteTransaction(m_trans);
|
||||
if (!errorCode)
|
||||
return true;
|
||||
|
||||
if (m_conn->GetLastError() == 1213)
|
||||
if (errorCode == ER_LOCK_DEADLOCK)
|
||||
{
|
||||
uint8 loopBreaker = 5; // Handle MySQL Errno 1213 without extending deadlock to the core itself
|
||||
for (uint8 i = 0; i < loopBreaker; ++i)
|
||||
if (m_conn->ExecuteTransaction(m_trans))
|
||||
if (!m_conn->ExecuteTransaction(m_trans))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user