delivery-sdk-net

By default, the SDK uses a retry policy, asking for requested content again in case of an error. You can disable the retry policy by setting the DeliveryOptions.EnableRetryPolicy parameter to false. The default policy retries the HTTP requests if the following status codes are returned:

or if there is one of the following connection problems:

The default retry policy performs retries using a randomized exponential backoff scheme to determine the interval between retries. It can be customized by changing parameters in DeliveryOptions.RetryPolicyOptions. The DeltaBackoff parameter specifies the back-off interval between retries. The MaxCumulativeWaitTime parameter specifies the maximum cumulative wait time. If the cumulative wait time exceeds this value, the client will stop retrying and return the error to the application. The default retry policy also respects the Retry-After response header.

IDeliveryClient client = DeliveryClientBuilder
    .WithOptions(builder => builder
        .WithEnvironmentId("<YOUR_ENVIRONMENT_ID>")
        .WithDefaultRetryPolicyOptions(new DefaultRetryPolicyOptions {
	    DeltaBackoff = TimeSpan.FromSeconds(1),
	    MaxCumulativeWaitTime = TimeSpan.FromSeconds(10)
	})
	.Build())
    .Build();

You can create your custom retry policy, for example with Polly, by implementing IRetryPolicy and IRetryPolicyProvider interfaces. The custom retry policy provider can be registered with DeliveryClientBuilder.WithRetryPolicyProvider or with the ServiceCollection.