Readded 502 handling

This commit is contained in:
RogueException
2016-06-22 16:10:19 -03:00
parent 7896afdc92
commit 6545509ade
2 changed files with 7 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
#pragma warning disable CS4014
using System;
using System.IO;
using System.Net;
using System.Threading;
using System.Threading.Tasks;
@@ -68,6 +69,10 @@ namespace Discord.Net.Queue
//We have all our semaphores, send the request
return await request.SendAsync().ConfigureAwait(false);
}
catch (HttpException ex) when (ex.StatusCode == HttpStatusCode.BadGateway)
{
continue;
}
catch (HttpRateLimitException ex)
{
Pause(ex.RetryAfterMilliseconds);

View File

@@ -127,7 +127,8 @@ namespace Discord.Net.Rest
if (statusCode == 429)
{
//TODO: Include bucket info
throw new HttpRateLimitException(int.Parse(response.Headers.GetValues("retry-after").First()));
int retryAfterMillis = int.Parse(response.Headers.GetValues("retry-after").First());
throw new HttpRateLimitException(retryAfterMillis);
}
string reason = null;