mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-02-15 00:03:38 -07:00
Retry on 503 status code
This commit is contained in:
parent
524c86b8f2
commit
991dfccf3c
|
|
@ -1,6 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
@ -22,6 +23,7 @@ namespace DiscordChatExporter.Core.Services
|
||||||
{
|
{
|
||||||
// Create retry policy
|
// Create retry policy
|
||||||
var retry = Retry.Create()
|
var retry = Retry.Create()
|
||||||
|
.Catch<HttpErrorStatusCodeException>(false, e => e.StatusCode == HttpStatusCode.ServiceUnavailable)
|
||||||
.Catch<HttpErrorStatusCodeException>(false, e => (int) e.StatusCode == 429)
|
.Catch<HttpErrorStatusCodeException>(false, e => (int) e.StatusCode == 429)
|
||||||
.WithMaxTryCount(10)
|
.WithMaxTryCount(10)
|
||||||
.WithDelay(TimeSpan.FromSeconds(0.4));
|
.WithDelay(TimeSpan.FromSeconds(0.4));
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue