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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 5 deletions

View File

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