Fix admin logs always causing an exception on first batch. (#6356)

This commit is contained in:
Pieter-Jan Briers
2022-02-28 11:21:29 +01:00
committed by GitHub
parent eaee0a8a4c
commit eeef210ae4

View File

@@ -108,6 +108,7 @@ public sealed partial class AdminLogSystem : SharedAdminLogSystem
} }
SubscribeLocalEvent<RoundStartingEvent>(RoundStarting); SubscribeLocalEvent<RoundStartingEvent>(RoundStarting);
SubscribeLocalEvent<GameRunLevelChangedEvent>(RunLevelChanged);
} }
public override async void Shutdown() public override async void Shutdown()
@@ -232,14 +233,21 @@ public sealed partial class AdminLogSystem : SharedAdminLogSystem
private void RoundStarting(RoundStartingEvent ev) private void RoundStarting(RoundStartingEvent ev)
{ {
Interlocked.Exchange(ref _currentLogId, 0);
CacheNewRound(); CacheNewRound();
}
if (_metricsEnabled) private void RunLevelChanged(GameRunLevelChangedEvent ev)
{
if (ev.New == GameRunLevel.PreRoundLobby)
{ {
PreRoundQueueCapReached.Set(0); Interlocked.Exchange(ref _currentLogId, 0);
QueueCapReached.Set(0);
LogsSent.Set(0); if (_metricsEnabled)
{
PreRoundQueueCapReached.Set(0);
QueueCapReached.Set(0);
LogsSent.Set(0);
}
} }
} }