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 cc743cd602
commit f26465398a

View File

@ -97,9 +97,10 @@ namespace BreCalClient
var jitterer = new Random();
var retryPolicy =
Policy.Handle<HttpRequestException>()
.OrResult<RestSharp.RestResponse>(resp => resp.StatusCode == HttpStatusCode.Unauthorized)
.WaitAndRetryAsync(3,
// Policy.Handle<HttpRequestException>()
Policy.HandleResult<RestSharp.RestResponse>(resp => resp.StatusCode == HttpStatusCode.Unauthorized)
//.OrResult<RestSharp.RestResponse>
.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;
}));
}