Browse Source

Dont crash the heartbeat task if unable to send a heartbeat

tags/1.0-rc
RogueException 8 years ago
parent
commit
83aca9acef
1 changed files with 9 additions and 3 deletions
  1. +9
    -3
      src/Discord.Net/WebSocket/DiscordSocketClient.cs

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

@@ -1513,7 +1513,6 @@ namespace Discord.WebSocket

private async Task RunHeartbeatAsync(int intervalMillis, CancellationToken cancelToken, ILogger logger)
{
//Clean this up when Discord's session patch is live
try
{
await logger.DebugAsync("Heartbeat Started").ConfigureAwait(false);
@@ -1529,8 +1528,15 @@ namespace Discord.WebSocket
}
}

await ApiClient.SendHeartbeatAsync(_lastSeq).ConfigureAwait(false);
_heartbeatTime = Environment.TickCount;
try
{
await ApiClient.SendHeartbeatAsync(_lastSeq).ConfigureAwait(false);
_heartbeatTime = Environment.TickCount;
}
catch (Exception ex)
{
await logger.WarningAsync("Heartbeat Errored", ex).ConfigureAwait(false);
}

await Task.Delay(intervalMillis, cancelToken).ConfigureAwait(false);
}


Loading…
Cancel
Save