Merge branch '2.3' into 2.4-pr

This commit is contained in:
RaidMax 2019-08-23 19:12:28 -05:00
commit d35001049f

View File

@ -556,18 +556,21 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
{ {
if (Plugin.Config.Configuration().StoreClientKills) if (Plugin.Config.Configuration().StoreClientKills)
{ {
_hitCache.Add(hit); lock (_hitCache)
if (_hitCache.Count > Detection.MAX_TRACKED_HIT_COUNT)
{ {
_hitCache.Add(hit);
using (var ctx = new DatabaseContext()) if (_hitCache.Count > Detection.MAX_TRACKED_HIT_COUNT)
{ {
ctx.AddRange(_hitCache);
await ctx.SaveChangesAsync();
}
_hitCache.Clear(); using (var ctx = new DatabaseContext())
{
ctx.AddRange(_hitCache);
await ctx.SaveChangesAsync();
}
_hitCache.Clear();
}
} }
} }
@ -578,7 +581,7 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
#if DEBUG #if DEBUG
if (clientDetection.TrackedHits.Count > 0) if (clientDetection.TrackedHits.Count > 0)
#else #else
if (clientDetection.TrackedHits.Count > Detection.MAX_TRACKED_HIT_COUNT) if (clientDetection.TrackedHits.Count > Detection.MAX_TRACKED_HIT_COUNT)
#endif #endif
{ {
while (clientDetection.TrackedHits.Count > 0) while (clientDetection.TrackedHits.Count > 0)