Fix the chat handler crashing

This commit is contained in:
Jordan Brown
2018-07-29 10:35:28 -04:00
parent a18d59ebba
commit 21d9a7b871
2 changed files with 13 additions and 4 deletions
@@ -238,18 +238,25 @@ namespace Tgstation.Server.Host.Components.Chat
//wait for a message
await Task.WhenAny(messageTasks.Select(x => x.Value)).ConfigureAwait(false);
//process completed ones
var toRemove = new List<IProvider>();
//process completed ones
foreach (var I in messageTasks.Where(x => x.Value.IsCompleted))
{
messageTasks.Remove(I.Key);
var message = await I.Value.ConfigureAwait(false);
await ProcessMessage(I.Key, message, cancellationToken).ConfigureAwait(false);
toRemove.Add(I.Key);
}
foreach (var I in toRemove)
messageTasks.Remove(I);
}
}
catch (OperationCanceledException) { }
catch(Exception e)
{
logger.LogError("Message monitor crashed!: Exception: {0}", e);
}
}
/// <inheritdoc />
+3 -1
View File
@@ -19,4 +19,6 @@ Server updates. Use FOLDERS so dependencies can be properly packaged
TgsAuthorize attribute |'ing doesn't work due to role names, change to params[]
Chat straight doesn't work, fix it
Chat straight doesn't work, fix it
Don't throw arg null exceptions with null [FromBody]'s, apparently that's allowed, return bad request instead