I am trying to manipulate polly retry policy based on response status code. If status code is 500, I need to retry after 3 minutes else I need to retry after 2, 4 seconds. I have something like this right now,
.OrResult<RestResponse>(
(response) => {
return !response.IsSuccessful || response.StatusCode != System.Net.HttpStatusCode.Conflict;
})
.WaitAndRetryAsync(new[] { TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(15) })
I can possibly add TimeSpan.FromSeconds(180) but I only want to do it if the response status code is 500.
Is there a way to do that?