From 991dfccf3c3b8333cbc8fc59c8cab2ff63946dc9 Mon Sep 17 00:00:00 2001 From: Alexey Golub Date: Sat, 9 Feb 2019 19:39:21 +0200 Subject: [PATCH] Retry on 503 status code --- DiscordChatExporter.Core/Services/DataService.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/DiscordChatExporter.Core/Services/DataService.cs b/DiscordChatExporter.Core/Services/DataService.cs index 1a50e1a2..99da855c 100644 --- a/DiscordChatExporter.Core/Services/DataService.cs +++ b/DiscordChatExporter.Core/Services/DataService.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Net; using System.Net.Http; using System.Net.Http.Headers; using System.Threading.Tasks; @@ -22,6 +23,7 @@ namespace DiscordChatExporter.Core.Services { // Create retry policy var retry = Retry.Create() + .Catch(false, e => e.StatusCode == HttpStatusCode.ServiceUnavailable) .Catch(false, e => (int) e.StatusCode == 429) .WithMaxTryCount(10) .WithDelay(TimeSpan.FromSeconds(0.4));