mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 04:37:00 +00:00
[9517] rewrote RA console using ACE
- moved SQL pinging to SqlDelayThread - use sAccountMgr instead of explict sql queries
This commit is contained in:
parent
bc5092686e
commit
39559fc73a
8 changed files with 307 additions and 179 deletions
|
|
@ -30,17 +30,28 @@ void SqlDelayThread::run()
|
|||
mysql_thread_init();
|
||||
#endif
|
||||
|
||||
const uint32 loopSleepms = 10;
|
||||
|
||||
const uint32 pingEveryLoop = m_dbEngine->GetPingIntervall()/loopSleepms;
|
||||
|
||||
uint32 loopCounter = 0;
|
||||
while (m_running)
|
||||
{
|
||||
// if the running state gets turned off while sleeping
|
||||
// empty the queue before exiting
|
||||
ACE_Based::Thread::Sleep(10);
|
||||
|
||||
ACE_Based::Thread::Sleep(loopSleepms);
|
||||
SqlOperation* s;
|
||||
while (m_sqlQueue.next(s))
|
||||
{
|
||||
s->Execute(m_dbEngine);
|
||||
delete s;
|
||||
}
|
||||
if((loopCounter++) >= pingEveryLoop)
|
||||
{
|
||||
loopCounter = 0;
|
||||
delete m_dbEngine->Query("SELECT 1");
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef DO_POSTGRESQL
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue