Merge branch '2.3' into 2.4-pr

This commit is contained in:
RaidMax 2019-08-24 20:16:35 -05:00
commit 7c0e37cc8e
3 changed files with 23 additions and 15 deletions

View File

@ -6,7 +6,7 @@
<RuntimeFrameworkVersion>2.2.2</RuntimeFrameworkVersion>
<MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish>
<PackageId>RaidMax.IW4MAdmin.Application</PackageId>
<Version>2.2.8.1</Version>
<Version>2.2.8.2</Version>
<Authors>RaidMax</Authors>
<Company>Forever None</Company>
<Product>IW4MAdmin</Product>
@ -34,8 +34,8 @@
<ServerGarbageCollection>false</ServerGarbageCollection>
<ConcurrentGarbageCollection>true</ConcurrentGarbageCollection>
<TieredCompilation>true</TieredCompilation>
<AssemblyVersion>2.2.8.1</AssemblyVersion>
<FileVersion>2.2.8.1</FileVersion>
<AssemblyVersion>2.2.8.2</AssemblyVersion>
<FileVersion>2.2.8.2</FileVersion>
<LangVersion>7.1</LangVersion>
</PropertyGroup>

View File

@ -48,6 +48,8 @@ namespace IW4MAdmin.Application.IO
await Task.Delay(_reader.UpdateInterval, _server.Manager.CancellationToken);
}
_server.Logger.WriteDebug("Stopped polling for changes");
}
private async Task UpdateLogEvents()

View File

@ -431,21 +431,21 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
// get individual client's stats
var clientStats = playerStats[pl.ClientId];
// remove the client from the stats dictionary as they're leaving
playerStats.TryRemove(pl.ClientId, out _);
detectionStats.TryRemove(pl.ClientId, out _);
// sync their stats before they leave
clientStats = UpdateStats(clientStats);
await SaveClientStats(clientStats);
// remove the client from the stats dictionary as they're leaving
playerStats.TryRemove(pl.ClientId, out _);
detectionStats.TryRemove(pl.ClientId, out _);
// increment the total play time
serverStats.TotalPlayTime += pl.ConnectionLength;
}
private static async Task SaveClientStats(EFClientStatistics clientStats)
{
using (var ctx = new DatabaseContext(disableTracking: true))
using (var ctx = new DatabaseContext())
{
ctx.Update(clientStats);
await ctx.SaveChangesAsync();
@ -533,11 +533,6 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
await AddStandardKill(attacker, victim);
}
if (hit.IsKillstreakKill)
{
return;
}
// incase the add player event get delayed
if (!_servers[serverId].PlayerStats.ContainsKey(attacker.ClientId))
{
@ -560,15 +555,21 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
await SaveClientStats(clientStats);
}
if (hit.IsKillstreakKill)
{
return;
}
try
{
if (Plugin.Config.Configuration().StoreClientKills)
{
OnProcessingPenalty.Wait();
_hitCache.Add(hit);
if (_hitCache.Count > Detection.MAX_TRACKED_HIT_COUNT)
{
OnProcessingPenalty.Wait();
using (var ctx = new DatabaseContext())
{
ctx.AddRange(_hitCache);
@ -576,8 +577,8 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
}
_hitCache.Clear();
OnProcessingPenalty.Release();
}
OnProcessingPenalty.Release(1);
}
@ -630,6 +631,11 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
{
_log.WriteError("Could not save hit or AC info");
_log.WriteDebug(ex.GetExceptionInfo());
if (OnProcessingPenalty.CurrentCount == 0)
{
OnProcessingPenalty.Release();
}
}
}