You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: USE_CASES.md
+16-7Lines changed: 16 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -587,28 +587,37 @@ namespace Example
587
587
<aname="transient_faults"></a>
588
588
# Transient Fault Handling
589
589
590
-
The SendGridClient provides functionality for handling transient errors that might occur when sending an HttpRequest. This includes client side timeouts while sending the mail, or any errors returned within the 500 range.
590
+
The SendGridClient provides functionality for handling transient errors that might occur when sending an HttpRequest. This includes client side timeouts while sending the mail, or certain errors returned within the 500 range. Errors within the 500 range are limited to 500 Internal Server Error, 502 Bad Gateway, 503 Service unavailable and 504 Gateway timeout.
591
591
592
592
By default, retry behaviour is off, you must explicitly enable it by setting the retry count to a value greater than zero. To set the retry count, you must use the SendGridClient construct that takes a **SendGridClientOptions** object, allowing you to configure the **ReliabilitySettings**
593
593
594
594
### RetryCount
595
595
596
-
The amount of times to retry the operation before reporting an exception to the caller. This is in addition to the initial attempt, so setting a value of 1 would result in 2 attempts - the initial attempt and the retry. Defaults to zero, so retry behaviour is not enabled. The maximum amount of retries permitted is 5.
596
+
The amount of times to retry the operation before reporting an exception to the caller. This is in addition to the initial attempt so setting a value of 1 would result in 2 attempts, the initial attempt and the retry. Defaults to zero, retry behaviour is not enabled. The maximum amount of retries permitted is 5.
597
597
598
-
### RetryInterval
598
+
### MinimumBackOff
599
+
600
+
The minimum amount of time to wait between retries.
601
+
602
+
### MaximumBackOff
603
+
604
+
The maximum possible amount of time to wait between retries. The maximum value allowed is 30 seconds
605
+
606
+
### DeltaBackOff
607
+
608
+
The value that will be used to calculate a random delta in the exponential delay between retries. A random element of time is factored into the delta calculation as this helps avoid many clients retrying at regular intervals.
599
609
600
-
The policy implemented is a 'wait and retry'. The RetryInterval setting defines the amount of time to wait between operations that fail before attempting a retry. By default, this is set to 1 second - the maximum amount of time allowed is 30 seconds.
601
610
602
611
## Examples
603
612
604
-
In this example, we are setting RetryCount to 1, with an interval between attempts of 5 seconds. This means that if the inital attempt to send mail fails, then it will wait 5 seconds then try again a single time.
613
+
In this example we are setting RetryCount to 2, with a mimimum wait time of 1 seconds, a maximum of 10 seconds and a delta of 3 seconds
/// Gets or sets the maximum number of retries to execute against when sending an HTTP Request before throwing an exception. Defaults to 0 (no retries, you must explicitly enable)
19
+
/// Initializes a new instance of the <see cref="ReliabilitySettings"/> class.
29
20
/// </summary>
30
-
publicintMaximumNumberOfRetries
21
+
/// <param name="maximumNumberOfRetries">The maximum number of retries to execute against when sending an HTTP Request before throwing an exception</param>
22
+
/// <param name="minimumBackoff">The minimum amount of time to wait between between HTTP retries</param>
23
+
/// <param name="maximumBackOff">the maximum amount of time to wait between between HTTP retries</param>
24
+
/// <param name="deltaBackOff">the value that will be used to calculate a random delta in the exponential delay between retries</param>
/// Gets the maximum number of retries to execute against when sending an HTTP Request before throwing an exception. Defaults to 0 (no retries, you must explicitly enable)
70
+
/// </summary>
71
+
publicintMaximumNumberOfRetries{get;}
72
+
73
+
/// <summary>
74
+
/// Gets the minimum amount of time to wait between between HTTP retries. Defaults to 1 second
75
+
/// </summary>
76
+
publicTimeSpanMinimumBackOff{get;}
77
+
78
+
/// <summary>
79
+
/// Gets the maximum amount of time to wait between between HTTP retries. Defaults to 10 seconds
80
+
/// </summary>
81
+
publicTimeSpanMaximumBackOff{get;}
82
+
83
+
/// <summary>
84
+
/// Gets the value that will be used to calculate a random delta in the exponential delay between retries. Defaults to 1 second
0 commit comments