1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-11 15:52:25 -05:00

Additional updates to support performance bucket

This commit is contained in:
RaidMax
2024-02-17 15:17:42 -06:00
parent e1461582fa
commit 962abcf833
18 changed files with 273 additions and 128 deletions

View File

@ -17,6 +17,7 @@ using Microsoft.Extensions.Logging;
using SharedLibraryCore.Database.Models;
using SharedLibraryCore.Events;
using SharedLibraryCore.Events.Game;
using SharedLibraryCore.Events.Game.GameScript.Zombie;
using SharedLibraryCore.Events.Management;
using Stats.Client.Abstractions;
using Stats.Client.Game;
@ -109,6 +110,39 @@ public class HitCalculator : IClientStatisticCalculator
return;
}
if (coreEvent is RoundEndEvent roundEndEvent)
{
foreach (var client in roundEndEvent.Server.ConnectedClients)
{
if (!_clientHitStatistics.TryGetValue(client.ClientId, out var state))
{
continue;
}
try
{
await state.OnTransaction.WaitAsync();
await UpdateClientStatistics(client.ClientId, state);
}
catch (Exception ex)
{
_logger.LogError(ex, "Could not handle round end calculations for client {Client}",
client.ToString());
}
finally
{
if (state.OnTransaction.CurrentCount == 0)
{
state.OnTransaction.Release();
}
}
}
return;
}
if (coreEvent is ClientStateDisposeEvent clientStateDisposeEvent)
{
_clientHitStatistics.Remove(clientStateDisposeEvent.Client.ClientId, out var state);