Core/World: Allow specifying minimum world updates diff in config
Port From (https://github.com/TrinityCore/TrinityCore/commit/833ddfad11fdb6af37bb70296dbc11613f4d0f5f)
This commit is contained in:
@@ -180,6 +180,7 @@ namespace WorldServer
|
||||
|
||||
static void WorldUpdateLoop()
|
||||
{
|
||||
int minUpdateDiff = ConfigMgr.GetDefaultValue("MinWorldUpdateTime", 1);
|
||||
uint realPrevTime = Time.GetMSTime();
|
||||
|
||||
while (!Global.WorldMgr.IsStopped)
|
||||
@@ -187,10 +188,10 @@ namespace WorldServer
|
||||
var realCurrTime = Time.GetMSTime();
|
||||
|
||||
uint diff = Time.GetMSTimeDiff(realPrevTime, realCurrTime);
|
||||
if (diff == 0)
|
||||
if (diff < minUpdateDiff)
|
||||
{
|
||||
// sleep until enough time passes that we can update all timers
|
||||
Thread.Sleep(1);
|
||||
Thread.Sleep(TimeSpan.FromMilliseconds(minUpdateDiff - diff));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user