actually fix it here

This commit is contained in:
RaidMax 2019-08-23 21:27:36 -05:00
parent 652f3fb86b
commit 563c73221e

View File

@ -551,26 +551,23 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
clientStats.HitLocations.Single(hl => hl.Location == hit.HitLoc).HitCount += 1; clientStats.HitLocations.Single(hl => hl.Location == hit.HitLoc).HitCount += 1;
} }
try try
{ {
if (Plugin.Config.Configuration().StoreClientKills) if (Plugin.Config.Configuration().StoreClientKills)
{ {
lock (_hitCache) _hitCache.Add(hit);
if (_hitCache.Count > Detection.MAX_TRACKED_HIT_COUNT)
{ {
_hitCache.Add(hit); OnProcessingPenalty.Wait();
using (var ctx = new DatabaseContext())
if (_hitCache.Count > Detection.MAX_TRACKED_HIT_COUNT)
{ {
ctx.AddRange(_hitCache);
using (var ctx = new DatabaseContext()) await ctx.SaveChangesAsync();
{
ctx.AddRange(_hitCache);
await ctx.SaveChangesAsync();
}
_hitCache.Clear();
} }
_hitCache.Clear();
OnProcessingPenalty.Release();
} }
} }