mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 22:37:02 +00:00
[11053] Process all SQL requests upon SqlDelayThread object destroying which might have been added while thread was stopping.
Signed-off-by: Ambal <pogrebniak@gala.net>
This commit is contained in:
parent
241712305d
commit
e6e7bf8573
3 changed files with 18 additions and 12 deletions
|
|
@ -26,10 +26,8 @@ SqlDelayThread::SqlDelayThread(Database* db, SqlConnection* conn) : m_dbEngine(d
|
|||
|
||||
SqlDelayThread::~SqlDelayThread()
|
||||
{
|
||||
//empty SQL queue before exiting
|
||||
SqlOperation* s = NULL;
|
||||
while (m_sqlQueue.next(s))
|
||||
delete s;
|
||||
//process all requests which might have been queued while thread was stopping
|
||||
ProcessRequests();
|
||||
}
|
||||
|
||||
void SqlDelayThread::run()
|
||||
|
|
@ -49,12 +47,7 @@ void SqlDelayThread::run()
|
|||
// empty the queue before exiting
|
||||
ACE_Based::Thread::Sleep(loopSleepms);
|
||||
|
||||
SqlOperation* s = NULL;
|
||||
while (m_sqlQueue.next(s))
|
||||
{
|
||||
s->Execute(m_dbConnection);
|
||||
delete s;
|
||||
}
|
||||
ProcessRequests();
|
||||
|
||||
if((loopCounter++) >= pingEveryLoop)
|
||||
{
|
||||
|
|
@ -72,3 +65,13 @@ void SqlDelayThread::Stop()
|
|||
{
|
||||
m_running = false;
|
||||
}
|
||||
|
||||
void SqlDelayThread::ProcessRequests()
|
||||
{
|
||||
SqlOperation* s = NULL;
|
||||
while (m_sqlQueue.next(s))
|
||||
{
|
||||
s->Execute(m_dbConnection);
|
||||
delete s;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue