mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-27 06:47:45 +00:00
Sql Keepalive in server zone
This commit is contained in:
parent
ccf51b909e
commit
bd7c2e8b37
3 changed files with 10 additions and 2 deletions
|
@ -44,7 +44,8 @@ Core::Db::DbWorkerPool< Core::Db::CharaDbConnection > g_charaDb;
|
|||
|
||||
Core::ServerZone::ServerZone( const std::string& configPath )
|
||||
: m_configPath( configPath ),
|
||||
m_bRunning( true )
|
||||
m_bRunning( true ),
|
||||
m_lastDBPingTime( 0 )
|
||||
{
|
||||
m_pConfig = XMLConfigPtr( new XMLConfig );
|
||||
}
|
||||
|
@ -272,6 +273,12 @@ void Core::ServerZone::mainLoop()
|
|||
}
|
||||
}
|
||||
|
||||
if( currTime - m_lastDBPingTime > 3 )
|
||||
{
|
||||
g_charaDb.keepAlive();
|
||||
m_lastDBPingTime = currTime;
|
||||
}
|
||||
|
||||
|
||||
auto it = this->m_sessionMap.begin();
|
||||
for( ; it != this->m_sessionMap.end(); )
|
||||
|
|
|
@ -51,6 +51,7 @@ namespace Core {
|
|||
|
||||
uint16_t m_port;
|
||||
std::string m_ip;
|
||||
uint32_t m_lastDBPingTime;
|
||||
|
||||
bool m_bRunning;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue