MCPcopy Create free account
hub / github.com/ddnet/ddnet / ProcessQueries

Method ProcessQueries

src/engine/server/databases/connection_pool.cpp:215–242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

213}
214
215void CBackup::ProcessQueries()
216{
217 for(int JobNum = 0;; JobNum++)
218 {
219 m_pShared->m_NumBackup.Wait();
220 CSqlExecData *pThreadData = m_pShared->m_aQueries[JobNum % std::size(m_pShared->m_aQueries)].get();
221
222 // work through all database jobs after OnShutdown is called before exiting the thread
223 if(pThreadData == nullptr)
224 {
225 m_pShared->m_NumWorker.Signal();
226 return;
227 }
228
229 if(pThreadData->m_Mode == CSqlExecData::ADD_SQLITE &&
230 pThreadData->m_Ptr.m_Sqlite.m_Mode == CDbConnectionPool::Mode::WRITE_BACKUP)
231 {
232 m_pWriteBackup = CreateSqliteConnection(pThreadData->m_Ptr.m_Sqlite.m_Filename, true);
233 }
234 else if(pThreadData->m_Mode == CSqlExecData::WRITE_ACCESS && m_pWriteBackup.get())
235 {
236 bool Success = CDbConnectionPool::ExecSqlFunc(m_pWriteBackup.get(), pThreadData, Write::BACKUP_FIRST);
237 if(m_DebugSql || !Success)
238 dbg_msg("sql", "[%i] %s done on write backup database, Success=%i", JobNum, pThreadData->m_pName, Success);
239 }
240 m_pShared->m_NumWorker.Signal();
241 }
242}
243
244// the worker threads executes queries on mysql or sqlite. If we write on
245// a mysql server and have a backup server configured, we'll remove the

Callers 1

StartMethod · 0.80

Calls 7

CreateSqliteConnectionFunction · 0.85
dbg_msgFunction · 0.85
CreateMysqlConnectionFunction · 0.85
getMethod · 0.80
SignalMethod · 0.80
GetApproximateValueMethod · 0.80
WaitMethod · 0.45

Tested by

no test coverage detected