[9517] rewrote RA console using ACE

- moved SQL pinging to SqlDelayThread
- use sAccountMgr instead of explict sql queries
This commit is contained in:
arrai 2010-03-01 23:27:05 +01:00
parent bc5092686e
commit 39559fc73a
8 changed files with 307 additions and 179 deletions

View file

@ -40,6 +40,7 @@ bool Database::Initialize(const char *)
m_logsDir.append("/");
}
m_pingIntervallms = sConfig.GetIntDefault ("MaxPingTime", 30) * (MINUTE * 1000);
return true;
}
@ -228,4 +229,4 @@ bool Database::CheckRequiredField( char const* table_name, char const* required_
sLog.outErrorDb("Table `%s` fields list query fail but expected have `%s`! No records in `%s`?",table_name,required_name,table_name);
return false;
}
}

View file

@ -130,8 +130,11 @@ class MANGOS_DLL_SPEC Database
void SetResultQueue(SqlResultQueue * queue);
bool CheckRequiredField(char const* table_name, char const* required_name);
uint32 GetPingIntervall() { return m_pingIntervallms;}
private:
bool m_logSQL;
std::string m_logsDir;
uint32 m_pingIntervallms;
};
#endif

View file

@ -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

View file

@ -18,10 +18,10 @@
#include "Util.h"
#include "sockets/socket_include.h"
#include "utf8cpp/utf8.h"
#include "mersennetwister/MersenneTwister.h"
#include <ace/TSS_T.h>
#include <ace/INET_Addr.h>
typedef ACE_TSS<MTRand> MTRandTSS;
static MTRandTSS mtRand;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "9516"
#define REVISION_NR "9517"
#endif // __REVISION_NR_H__