fix(core): Adds Hashed & Hierarchical Timer Wheel (#655)

- Removes TimerPriority
- Removes TimerThread
- Adds a [Hashed & Hierarchical Timer Wheel](http://www.cs.columbia.edu/~nahum/w6998/papers/ton97-timing-wheels.pdf)
This commit is contained in:
Kamron Batman 2021-07-11 22:42:06 -07:00 committed by GitHub
parent b99d520019
commit fb915992dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
138 changed files with 468 additions and 802 deletions

View file

@ -188,7 +188,7 @@ namespace Server.Engines.Spawners
[CommandProperty(AccessLevel.Developer)]
public TimeSpan NextSpawn
{
get => m_Running && m_Timer?.Running == true ? End - Core.Now : TimeSpan.FromSeconds(0);
get => m_Running && m_Timer?.Running == true ? End - Core.Now : TimeSpan.Zero;
set
{
Start();
@ -1003,12 +1003,7 @@ namespace Server.Engines.Spawners
m_HomeRange = reader.ReadInt();
m_Running = reader.ReadBool();
var ts = TimeSpan.Zero;
if (m_Running)
{
ts = reader.ReadDeltaTime() - Core.Now;
}
var ts = m_Running ? reader.ReadDeltaTime() - Core.Now : TimeSpan.Zero;
if (version < 7)
{
@ -1083,12 +1078,7 @@ namespace Server.Engines.Spawners
{
private readonly BaseSpawner m_Spawner;
public InternalTimer(BaseSpawner spawner, TimeSpan delay) : base(delay)
{
Priority = spawner.IsFull ? TimerPriority.FiveSeconds : TimerPriority.OneSecond;
m_Spawner = spawner;
}
public InternalTimer(BaseSpawner spawner, TimeSpan delay) : base(delay) => m_Spawner = spawner;
protected override void OnTick()
{