var appendFileResponse = await Policy
.HandleResult<HttpResponseMessage>(message => !message.IsSuccessStatusCode)
.WaitAndRetryAsync(3, retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)))
.ExecuteAsync(async () => await httpClient.SendAsync(request).ConfigureAwait(true))
.ConfigureAwait(true);
if (appendFileResponse.StatusCode != System.Net.HttpStatusCode.Accepted)
{
throw new ApplicationException($"Failed to append file");
}
I want to make sure appendFileResponse
is completed before doing the If check and some other operations.
Should I add ConfigureAwait(true)
in the httpClient.SendAsync
call and/or .ConfigureAwait(true)
in the await Policy?