Commit cb0c2342 authored by Pavel Vainerman's avatar Pavel Vainerman

(DBServer): добавил обработку sigterm(), чтобы сбрасывать буферы..

parent a1aeea4a
...@@ -295,6 +295,9 @@ void DBServer_MySQL::flushQBuffer() ...@@ -295,6 +295,9 @@ void DBServer_MySQL::flushQBuffer()
//-------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------
void DBServer_MySQL::flushTableBuffer( DBTableMap::iterator& it ) void DBServer_MySQL::flushTableBuffer( DBTableMap::iterator& it )
{ {
if( !db || !connect_ok )
return;
if( it == tblMap.end() ) if( it == tblMap.end() )
return; return;
...@@ -608,3 +611,22 @@ void DBServer_MySQL::timerInfo( UniSetTypes::TimerMessage* tm ) ...@@ -608,3 +611,22 @@ void DBServer_MySQL::timerInfo( UniSetTypes::TimerMessage* tm )
} }
} }
//-------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------
void DBServer_MySQL::sigterm( int signo )
{
for( DBTableMap::iterator it=tblMap.begin(); it!=tblMap.end(); ++it )
{
try {
flushTableBuffer(it);
}
catch(...){}
}
try
{
flushQBuffer();
}
catch(...){}
DBServer::sigterm(signo);
}
//--------------------------------------------------------------------------------------------
...@@ -220,6 +220,8 @@ class DBServer_MySQL: ...@@ -220,6 +220,8 @@ class DBServer_MySQL:
void flushQBuffer(); void flushQBuffer();
virtual void sigterm( int signo );
private: private:
DBTableMap tblMap; DBTableMap tblMap;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment