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:
@ -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);
|
||||
|
Reference in New Issue
Block a user