Fixed crash
This commit is contained in:
parent
8b3a438e34
commit
cf0f0be84f
@ -47,16 +47,22 @@ namespace NadekoBot.Modules.Administration
|
|||||||
}
|
}
|
||||||
|
|
||||||
t = new Timer(async (state) =>
|
t = new Timer(async (state) =>
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
var keys = UserPresenceUpdates.Keys.ToList();
|
var keys = UserPresenceUpdates.Keys.ToList();
|
||||||
|
|
||||||
await Task.WhenAll(keys.Select(key =>
|
await Task.WhenAll(keys.Select(async key =>
|
||||||
{
|
{
|
||||||
List<string> messages;
|
List<string> messages;
|
||||||
if (UserPresenceUpdates.TryRemove(key, out messages))
|
if (UserPresenceUpdates.TryRemove(key, out messages))
|
||||||
try { return key.SendMessageAsync(string.Join(Environment.NewLine, messages)); } catch { } //502/403
|
try { await key.SendMessageAsync(string.Join(Environment.NewLine, messages)); } catch { }
|
||||||
return Task.CompletedTask;
|
|
||||||
}));
|
}));
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_log.Warn(ex);
|
||||||
|
}
|
||||||
}, null, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(10));
|
}, null, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(10));
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user