reduced retry to single request and reset the error text line

This commit is contained in:
Daniel Schick 2024-05-13 19:31:59 +02:00
parent 6973ec64fe
commit c5df95625d

View File

@ -97,9 +97,10 @@ namespace BreCalClient
var jitterer = new Random(); var jitterer = new Random();
var retryPolicy = var retryPolicy =
Policy.Handle<HttpRequestException>() // Policy.Handle<HttpRequestException>()
.OrResult<RestSharp.RestResponse>(resp => resp.StatusCode == HttpStatusCode.Unauthorized) Policy.HandleResult<RestSharp.RestResponse>(resp => resp.StatusCode == HttpStatusCode.Unauthorized)
.WaitAndRetryAsync(3, //.OrResult<RestSharp.RestResponse>
.WaitAndRetryAsync(1,
retryAttempt => retryAttempt =>
{ {
var calculatedDelayInMilliseconds = Math.Pow(2, retryAttempt) * 1000; var calculatedDelayInMilliseconds = Math.Pow(2, retryAttempt) * 1000;
@ -114,6 +115,7 @@ namespace BreCalClient
Trace.WriteLine("token refreshed"); Trace.WriteLine("token refreshed");
}); });
RetryConfiguration.AsyncRetryPolicy = retryPolicy; RetryConfiguration.AsyncRetryPolicy = retryPolicy;
this.generalProgressStatus.Maximum = PROGRESS_STEPS; this.generalProgressStatus.Maximum = PROGRESS_STEPS;
} }
@ -445,6 +447,7 @@ namespace BreCalClient
{ {
labelGeneralStatus.Text = $"Connection {ConnectionStatus.SUCCESSFUL}"; labelGeneralStatus.Text = $"Connection {ConnectionStatus.SUCCESSFUL}";
labelLatestUpdate.Text = $"Last update: {DateTime.Now.ToLongTimeString()}"; labelLatestUpdate.Text = $"Last update: {DateTime.Now.ToLongTimeString()}";
labelStatusBar.Text = "";
generalProgressStatus.Value = 0; generalProgressStatus.Value = 0;
})); }));
} }