File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed
Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ public class ExponentialRetryInterval : IRetryIntervalStrategy
1212
1313 private int _count ;
1414
15- private TimeSpan _first ;
15+ private TimeSpan _initial ;
1616
1717 private TimeSpan _maxDelay ;
1818
@@ -21,13 +21,13 @@ public class ExponentialRetryInterval : IRetryIntervalStrategy
2121 /// <summary>
2222 /// Initializes a new instance of the <see cref="ExponentialRetryInterval"/> class.
2323 /// </summary>
24- /// <param name="first ">The first .</param>
24+ /// <param name="initial ">The initial .</param>
2525 /// <param name="max">The maximum.</param>
26- public ExponentialRetryInterval ( TimeSpan first , TimeSpan max )
26+ public ExponentialRetryInterval ( TimeSpan initial , TimeSpan ? max = null )
2727 {
28- _first = first ;
29- _pre = first ;
30- _maxDelay = max ;
28+ _initial = initial ;
29+ _pre = initial ;
30+ _maxDelay = max ?? TimeSpan . MaxValue ;
3131
3232 _random = new Random ( ) ;
3333 }
@@ -43,7 +43,7 @@ public TimeSpan GetInterval()
4343 }
4444
4545 var delta = ( Math . Pow ( 2 , _count ) - 1.0 ) * ( 1.0 + ( _random . NextDouble ( ) * ( 1.1 - 1.0 ) ) ) ;
46- var delay = Math . Min ( _first . TotalMilliseconds * delta , _maxDelay . TotalMilliseconds ) ;
46+ var delay = Math . Min ( _initial . TotalMilliseconds * delta , _maxDelay . TotalMilliseconds ) ;
4747
4848 _pre = TimeSpan . FromMilliseconds ( delay ) ;
4949
Original file line number Diff line number Diff line change 88 <GenerateDocumentationFile >True</GenerateDocumentationFile >
99 <LangVersion >latest</LangVersion >
1010
11- <Version >0.3.0 </Version >
11+ <Version >0.3.1 </Version >
1212 <PackageId >$(AssemblyName)</PackageId >
1313 <Description >A library for retrying operations.</Description >
1414 <Authors >jerviscui</Authors >
You can’t perform that action at this time.
0 commit comments