Browse Source

fix: ensure that exceptions will be logged

Resolves #1238.

I'm not sure where this bug came from, a git blame revealed no change to
the timed event handler code since it was initiall written two years
ago.

I've found that when the event handler times out, the handler task will
be manually completed (as opposed to within Task.WhenAny), which then
bubbles the exception and allows the error to be logged.

Ensuring that the handler is completed individually, regardless of
whether or not the timeout task completed, seems to fix this problem.
tags/2.1.0
Christopher Felegy 6 years ago
parent
commit
f6e320053b
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      src/Discord.Net.WebSocket/DiscordSocketClient.cs

+ 1
- 1
src/Discord.Net.WebSocket/DiscordSocketClient.cs View File

@@ -1861,8 +1861,8 @@ namespace Discord.WebSocket
if (await Task.WhenAny(timeoutTask, handlersTask).ConfigureAwait(false) == timeoutTask)
{
await _gatewayLogger.WarningAsync($"A {name} handler is blocking the gateway task.").ConfigureAwait(false);
await handlersTask.ConfigureAwait(false); //Ensure the handler completes
}
await handlersTask.ConfigureAwait(false); //Ensure the handler completes
}
catch (Exception ex)
{


Loading…
Cancel
Save