Fix small issue with saving client kills multithreaded
This commit is contained in:
parent
91078eec0f
commit
652f3fb86b
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user