Core/World: Include more details about MaxCoreStuckTime asserts

Port From (https://github.com/TrinityCore/TrinityCore/commit/c80d7696c332cbe45cb0457a75b4f56381317a69)
This commit is contained in:
hondacrx
2022-10-01 16:48:27 -04:00
parent e9ad8c63f8
commit 95842900a7
+10 -1
View File
@@ -184,6 +184,11 @@ namespace WorldServer
int minUpdateDiff = ConfigMgr.GetDefaultValue("MinWorldUpdateTime", 1);
uint realPrevTime = Time.GetMSTime();
uint maxCoreStuckTime = ConfigMgr.GetDefaultValue("MaxCoreStuckTime", 60u) * 1000u;
uint halfMaxCoreStuckTime = maxCoreStuckTime / 2;
if (halfMaxCoreStuckTime == 0)
halfMaxCoreStuckTime = uint.MaxValue;
while (!Global.WorldMgr.IsStopped)
{
var realCurrTime = Time.GetMSTime();
@@ -191,8 +196,12 @@ namespace WorldServer
uint diff = Time.GetMSTimeDiff(realPrevTime, realCurrTime);
if (diff < minUpdateDiff)
{
uint sleepTime = (uint)(minUpdateDiff - diff);
if (sleepTime >= halfMaxCoreStuckTime)
Log.outError(LogFilter.Server, $"WorldUpdateLoop() waiting for {sleepTime} ms with MaxCoreStuckTime set to {maxCoreStuckTime} ms");
// sleep until enough time passes that we can update all timers
Thread.Sleep(TimeSpan.FromMilliseconds(minUpdateDiff - diff));
Thread.Sleep(TimeSpan.FromMilliseconds(sleepTime));
continue;
}