From c5df95625d9805ebea16dd6d728131bcdf97d2b7 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Mon, 13 May 2024 19:31:59 +0200 Subject: [PATCH] reduced retry to single request and reset the error text line --- src/BreCalClient/MainWindow.xaml.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/BreCalClient/MainWindow.xaml.cs b/src/BreCalClient/MainWindow.xaml.cs index 51c9f1b..1a01de8 100644 --- a/src/BreCalClient/MainWindow.xaml.cs +++ b/src/BreCalClient/MainWindow.xaml.cs @@ -97,9 +97,10 @@ namespace BreCalClient var jitterer = new Random(); var retryPolicy = - Policy.Handle() - .OrResult(resp => resp.StatusCode == HttpStatusCode.Unauthorized) - .WaitAndRetryAsync(3, + // Policy.Handle() + Policy.HandleResult(resp => resp.StatusCode == HttpStatusCode.Unauthorized) + //.OrResult + .WaitAndRetryAsync(1, retryAttempt => { var calculatedDelayInMilliseconds = Math.Pow(2, retryAttempt) * 1000; @@ -114,6 +115,7 @@ namespace BreCalClient Trace.WriteLine("token refreshed"); }); RetryConfiguration.AsyncRetryPolicy = retryPolicy; + this.generalProgressStatus.Maximum = PROGRESS_STEPS; } @@ -445,6 +447,7 @@ namespace BreCalClient { labelGeneralStatus.Text = $"Connection {ConnectionStatus.SUCCESSFUL}"; labelLatestUpdate.Text = $"Last update: {DateTime.Now.ToLongTimeString()}"; + labelStatusBar.Text = ""; generalProgressStatus.Value = 0; })); }