Readded 502 handling
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
#pragma warning disable CS4014
|
#pragma warning disable CS4014
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Net;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@@ -68,6 +69,10 @@ namespace Discord.Net.Queue
|
|||||||
//We have all our semaphores, send the request
|
//We have all our semaphores, send the request
|
||||||
return await request.SendAsync().ConfigureAwait(false);
|
return await request.SendAsync().ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
catch (HttpException ex) when (ex.StatusCode == HttpStatusCode.BadGateway)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
catch (HttpRateLimitException ex)
|
catch (HttpRateLimitException ex)
|
||||||
{
|
{
|
||||||
Pause(ex.RetryAfterMilliseconds);
|
Pause(ex.RetryAfterMilliseconds);
|
||||||
|
|||||||
@@ -127,7 +127,8 @@ namespace Discord.Net.Rest
|
|||||||
if (statusCode == 429)
|
if (statusCode == 429)
|
||||||
{
|
{
|
||||||
//TODO: Include bucket info
|
//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;
|
string reason = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user