Core/Misc: Multithread query cache loading
This commit is contained in:
1 parent
4e0e5785e9
commit
6c171229e9
1 file changed
+13
-8
@@ -56,6 +56,7 @@
|
||||
#include "SpellScript.h"
|
||||
#include "TemporarySummon.h"
|
||||
#include "TerrainMgr.h"
|
||||
#include "ThreadPool.h"
|
||||
#include "UpdateMask.h"
|
||||
#include "Util.h"
|
||||
#include "Vehicle.h"
|
||||
@@ -10234,25 +10235,29 @@ void ObjectMgr::InitializeQueriesData(QueryDataGroup mask)
|
||||
return;
|
||||
}
|
||||
|
||||
Trinity::ThreadPool pool;
|
||||
|
||||
// Initialize Query data for creatures
|
||||
if (mask & QUERY_DATA_CREATURES)
|
||||
for (auto& creaturePair : _creatureTemplateStore)
|
||||
creaturePair.second.InitializeQueryData();
|
||||
for (auto& creatureTemplatePair : _creatureTemplateStore)
|
||||
pool.PostWork([creature = &creatureTemplatePair.second]() { creature->InitializeQueryData(); });
|
||||
|
||||
// Initialize Query Data for gameobjects
|
||||
if (mask & QUERY_DATA_GAMEOBJECTS)
|
||||
for (auto& gameobjectPair : _gameObjectTemplateStore)
|
||||
gameobjectPair.second.InitializeQueryData();
|
||||
for (auto& gameObjectTemplatePair : _gameObjectTemplateStore)
|
||||
pool.PostWork([gobj = &gameObjectTemplatePair.second]() { gobj->InitializeQueryData(); });
|
||||
|
||||
// Initialize Query Data for quests
|
||||
if (mask & QUERY_DATA_QUESTS)
|
||||
for (auto& questPair : _questTemplates)
|
||||
questPair.second.InitializeQueryData();
|
||||
for (auto& questTemplatePair : _questTemplates)
|
||||
pool.PostWork([quest = &questTemplatePair.second]() { quest->InitializeQueryData(); });
|
||||
|
||||
// Initialize Quest POI data
|
||||
if (mask & QUERY_DATA_POIS)
|
||||
for (auto& poiPair : _questPOIStore)
|
||||
poiPair.second.InitializeQueryData();
|
||||
for (auto& poiWrapperPair : _questPOIStore)
|
||||
pool.PostWork([poi = &poiWrapperPair.second]() { poi->InitializeQueryData(); });
|
||||
|
||||
pool.Join();
|
||||
|
||||
TC_LOG_INFO("server.loading", ">> Initialized query cache data in %u ms", GetMSTimeDiffToNow(oldMSTime));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user