@@ -7,17 +7,21 @@ namespace SendGrid.Helpers.Reliability
77 /// </summary>
88 public class ReliabilitySettings
99 {
10- private int retryCount ;
10+ private int maximumNumberOfRetries ;
1111
12- private TimeSpan retryInterval ;
12+ private TimeSpan minimumBackOff ;
13+ private TimeSpan maximumBackOff ;
14+ private TimeSpan deltaBackOff ;
1315
1416 /// <summary>
1517 /// Initializes a new instance of the <see cref="ReliabilitySettings"/> class.
1618 /// </summary>
1719 public ReliabilitySettings ( )
1820 {
19- this . retryCount = 0 ;
20- this . retryInterval = TimeSpan . FromSeconds ( 1 ) ;
21+ this . maximumNumberOfRetries = 0 ;
22+ this . minimumBackOff = TimeSpan . FromSeconds ( 1 ) ;
23+ this . deltaBackOff = TimeSpan . FromSeconds ( 1 ) ;
24+ this . maximumBackOff = TimeSpan . FromSeconds ( 10 ) ;
2125 }
2226
2327 /// <summary>
@@ -27,7 +31,7 @@ public int MaximumNumberOfRetries
2731 {
2832 get
2933 {
30- return this . retryCount ;
34+ return this . maximumNumberOfRetries ;
3135 }
3236
3337 set
@@ -42,28 +46,64 @@ public int MaximumNumberOfRetries
4246 throw new ArgumentException ( "The maximum number of retries that can be attempted is 5" ) ;
4347 }
4448
45- this . retryCount = value ;
49+ this . maximumNumberOfRetries = value ;
4650 }
4751 }
4852
4953 /// <summary>
5054 /// Gets or sets the interval between HTTP retries. Defaults to 1 second
5155 /// </summary>
52- public TimeSpan RetryInterval
56+ public TimeSpan MinimumBackOff
5357 {
5458 get
5559 {
56- return this . retryInterval ;
60+ return this . minimumBackOff ;
5761 }
5862
5963 set
6064 {
6165 if ( value . TotalSeconds > 30 )
6266 {
63- throw new ArgumentException ( "The maximum retry interval is 30 seconds" ) ;
67+ throw new ArgumentException ( "The maximum setting for minimum back off is 30 seconds" ) ;
6468 }
6569
66- this . retryInterval = value ;
70+ this . minimumBackOff = value ;
71+ }
72+ }
73+
74+ public TimeSpan MaximumBackOff
75+ {
76+ get
77+ {
78+ return this . maximumBackOff ;
79+ }
80+
81+ set
82+ {
83+ if ( value . TotalSeconds > 30 )
84+ {
85+ throw new ArgumentException ( "The maximum setting to back off for is 30 seconds" ) ;
86+ }
87+
88+ this . maximumBackOff = value ;
89+ }
90+ }
91+
92+ public TimeSpan DeltaBackOff
93+ {
94+ get
95+ {
96+ return this . deltaBackOff ;
97+ }
98+
99+ set
100+ {
101+ if ( value . TotalSeconds > 30 )
102+ {
103+ throw new ArgumentException ( "The maximum delta interval is 5 seconds" ) ;
104+ }
105+
106+ this . deltaBackOff = value ;
67107 }
68108 }
69109 }
0 commit comments