Skip to content

Commit e4f8576

Browse files
Merge pull request #124 from UchuServer/make-update-debug
made tick skipping logging less agressive
2 parents f97a2f3 + 9fc239f commit e4f8576

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

Uchu.World/Objects/Zone.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public class Zone : Object
6161
private long _passedTickTime;
6262
private bool _running;
6363
private int _ticks;
64+
private int _skippedTicks;
6465
private long _physicsTime;
6566
private long _objectUpdateTime;
6667
private long _scheduleUpdateTime;
@@ -549,14 +550,20 @@ private Timer SetupTickReporter()
549550
timer.Elapsed += (sender, args) =>
550551
{
551552
if (_ticks > 0)
553+
{
552554
Logger.Debug($"TPS: {_ticks}/{TicksPerSecondLimit} " +
553555
$"TPT: {_passedTickTime / _ticks}ms [{_physicsTime / _ticks}|" +
554556
$"{_objectUpdateTime / _ticks}|{_scheduleUpdateTime / _ticks}]");
557+
}
558+
559+
if (_skippedTicks >= TicksPerSecondLimit / 2)
560+
Logger.Warning($"Can't keep up, skipped {_skippedTicks}/{TicksPerSecondLimit} ticks!");
555561

556-
_scheduleUpdateTime = 0;
557-
_objectUpdateTime = 0;
558562
_passedTickTime = 0;
563+
_objectUpdateTime = 0;
559564
_physicsTime = 0;
565+
_scheduleUpdateTime = 0;
566+
_skippedTicks = 0;
560567
_ticks = 0;
561568
};
562569

@@ -574,7 +581,7 @@ private async Task Tick()
574581

575582
if (CalculatingTick)
576583
{
577-
Logger.Warning("Can't keep up! Skipping tick.");
584+
_skippedTicks++;
578585
return;
579586
}
580587

0 commit comments

Comments
 (0)