1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-10 15:20:48 -05:00

finer version numbers work correctly.

fix bug with level being reset.
add {{ADMINS}} to message tokens
modified offset threshold calculation
This commit is contained in:
RaidMax
2018-06-26 20:17:24 -05:00
parent f73ddf5ad1
commit cd330eef97
12 changed files with 71 additions and 35 deletions

View File

@ -81,14 +81,18 @@ namespace IW4MAdmin.Application
public async Task UpdateStatus(object state)
{
var taskList = new List<Task>();
var taskList = new Dictionary<int, Task>();
while (Running)
{
taskList.Clear();
var tasksToRemove = taskList.Where(t => t.Value.Status == TaskStatus.RanToCompletion)
.Select(t => t.Key).ToList();
tasksToRemove.ForEach(t => taskList.Remove(t));
foreach (var server in Servers)
{
taskList.Add(Task.Run(async () =>
var newTask = Task.Run(async () =>
{
try
{
@ -101,7 +105,12 @@ namespace IW4MAdmin.Application
Logger.WriteDebug($"Exception: {e.Message}");
Logger.WriteDebug($"StackTrace: {e.StackTrace}");
}
}));
});
if (!taskList.ContainsKey(server.GetHashCode()))
{
taskList.Add(server.GetHashCode(), newTask);
}
}
#if DEBUG
Logger.WriteDebug($"{taskList.Count} servers queued for stats updates");
@ -110,7 +119,7 @@ namespace IW4MAdmin.Application
Logger.WriteDebug($"There are {workerThreads - availableThreads} active threading tasks");
#endif
await Task.WhenAll(taskList.ToArray());
await Task.WhenAny(taskList.Values.ToArray());
GameEvent sensitiveEvent;
while ((sensitiveEvent = Handler.GetNextSensitiveEvent()) != null)