27 .Handle<HttpRequestException>()
28 .Or<SocketException>()
30 .Or<InvalidOperationException>()
31 .OrResult<HttpResponseMessage>(r => r.StatusCode == HttpStatusCode.TooManyRequests)
32 .WaitAndRetryAsync(retryCount, attempt =>
34 int calculated = (int)Math.Floor(Math.Pow(2, attempt));
35 int backoff = calculated > maxBackoff.Seconds ? maxBackoff.Seconds : calculated;
36 return TimeSpan.FromSeconds(backoff);