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()
|
static void WorldUpdateLoop()
|
||||||
{
|
{
|
||||||
|
int minUpdateDiff = ConfigMgr.GetDefaultValue("MinWorldUpdateTime", 1);
|
||||||
uint realPrevTime = Time.GetMSTime();
|
uint realPrevTime = Time.GetMSTime();
|
||||||
|
|
||||||
while (!Global.WorldMgr.IsStopped)
|
while (!Global.WorldMgr.IsStopped)
|
||||||
@@ -187,10 +188,10 @@ namespace WorldServer
|
|||||||
var realCurrTime = Time.GetMSTime();
|
var realCurrTime = Time.GetMSTime();
|
||||||
|
|
||||||
uint diff = Time.GetMSTimeDiff(realPrevTime, realCurrTime);
|
uint diff = Time.GetMSTimeDiff(realPrevTime, realCurrTime);
|
||||||
if (diff == 0)
|
if (diff < minUpdateDiff)
|
||||||
{
|
{
|
||||||
// sleep until enough time passes that we can update all timers
|
// sleep until enough time passes that we can update all timers
|
||||||
Thread.Sleep(1);
|
Thread.Sleep(TimeSpan.FromMilliseconds(minUpdateDiff - diff));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -331,6 +331,13 @@ SessionAddDelay = 10000
|
|||||||
|
|
||||||
GridCleanUpDelay = 300000
|
GridCleanUpDelay = 300000
|
||||||
|
|
||||||
|
#
|
||||||
|
# MinWorldUpdateTime
|
||||||
|
# Description: Minimum time (milliseconds) between world update ticks (for mostly idle servers).
|
||||||
|
# Default: 1 - (0.001 second)
|
||||||
|
|
||||||
|
MinWorldUpdateTime = 1
|
||||||
|
|
||||||
#
|
#
|
||||||
# MapUpdateInterval
|
# MapUpdateInterval
|
||||||
# Description: Time (milliseconds) for map update interval.
|
# Description: Time (milliseconds) for map update interval.
|
||||||
|
|||||||
Reference in New Issue
Block a user