RetryPolicy¶
Namespace Pain001.Sdk.
An opt-in retry policy for the idempotent calls: GET requests only (Pain001Client.HealthAsync, Pain001Client.FacesAsync, and Pain001Client.RequestAsync with GET).
Remarks¶
Set it on Pain001ClientOptions.Retry; without one the client sends every request once. A POST (validate, generate, check, a face projection) is never retried, whatever the policy: a second generate is a second payment file.
A GET is sent again when the server answers HTTP 429 or 503, or when the request fails to connect (HttpRequestException), up to RetryPolicy.MaxAttempts attempts in all. Between attempts the client waits an exponential backoff with jitter: for attempt n, a random time between half and all of min(MaxDelay, InitialDelay × 2^(n-1)). A Retry-After header on a 429 or 503 replaces the backoff; when it asks for longer than RetryPolicy.MaxDelay the client stops and returns that answer instead of waiting. A timeout or a cancelled request is not retried.
Properties¶
InitialDelay¶
The backoff before the second attempt. Defaults to 200 ms.
| Exception | When |
|---|---|
ArgumentOutOfRangeException |
The value is negative. |
MaxAttempts¶
The attempts in all, the first included. Defaults to 3; 1 means no retry.
| Exception | When |
|---|---|
ArgumentOutOfRangeException |
The value is below 1. |
MaxDelay¶
The longest the client waits between two attempts, for the backoff and for a Retry-After. Defaults to 5 seconds.
| Exception | When |
|---|---|
ArgumentOutOfRangeException |
The value is negative. |