[Player Events] Add QS processing, mutex tweaks (#2984)

* [Player Events] Add QS processing, mutex tweaks

* Update ucs.cpp

* Move the size process check out of the server to server networking thread
This commit is contained in:
Chris Miles
2023-02-24 18:01:59 -06:00
committed by GitHub
parent e8f1aa253a
commit bad631df59
5 changed files with 33 additions and 21 deletions
+4 -4
View File
@@ -70,19 +70,17 @@ DBcore::~DBcore()
// Sends the MySQL server a keepalive
void DBcore::ping()
{
if (!m_query_lock.try_lock()) {
if (!MDatabase.trylock()) {
// well, if's it's locked, someone's using it. If someone's using it, it doesnt need a keepalive
return;
}
mysql_ping(&mysql);
m_query_lock.unlock();
MDatabase.unlock();
}
MySQLRequestResult DBcore::QueryDatabase(std::string query, bool retryOnFailureOnce)
{
m_query_lock.lock();
auto r = QueryDatabase(query.c_str(), query.length(), retryOnFailureOnce);
m_query_lock.unlock();
return r;
}
@@ -98,6 +96,8 @@ MySQLRequestResult DBcore::QueryDatabase(const char *query, uint32 querylen, boo
BenchTimer timer;
timer.reset();
LockMutex lock(&MDatabase);
// Reconnect if we are not connected before hand.
if (pStatus != Connected) {
Open();