Automatic retries
The WhenFresh API implements automatic retry logic using an exponential backoff. The idea behind exponential backoff is to use progressively longer waits between retries for consecutive error responses. By default the retry logic is configured to retry a maximum of 3 times, with an initial backoff time set to 100 milliseconds.
You can override both of these settings in the WhenFreshClient options:
var client = new WhenFreshApiClient(options =>
{
options.Retries.MaxRetries = 3;
options.Retries.InitialBackOff = TimeSpan.FromMilliseconds(value: 100);
});
Disabling retries
In scenarios where you already have your own retry logic in place, for example when using the WhenFresh API behind a queue, you should disable the automatic retries by setting the MaxRetries value to 0.