SendWithRetryAsync(HttpClient, Func<HttpRequestMessage>, CancellationToken) Method
Retries a request with exponential back-off. This helps with websites like GitHub that will give us a 429 (TooManyRequests).
Namespace
Statiq.Core
Containing Type
HttpClientExtensions

Syntax

public static Task<HttpResponseMessage> SendWithRetryAsync(this HttpClient httpClient, Func<HttpRequestMessage> requestFactory, CancellationToken cancellationToken = default(CancellationToken))

Parameters

Name Type Description
httpClient HttpClient The client.
requestFactory Func<HttpRequestMessage> A factory that creates the request message to send (a fresh message is needed for each request).
cancellationToken CancellationToken A cancellation token.

Return Value

Type Description
Task<HttpResponseMessage> The response.