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
12
12
13
13
private int _count ;
14
14
15
- private TimeSpan _first ;
15
+ private TimeSpan _initial ;
16
16
17
17
private TimeSpan _maxDelay ;
18
18
@@ -21,13 +21,13 @@ public class ExponentialRetryInterval : IRetryIntervalStrategy
21
21
/// <summary>
22
22
/// Initializes a new instance of the <see cref="ExponentialRetryInterval"/> class.
23
23
/// </summary>
24
- /// <param name="first ">The first .</param>
24
+ /// <param name="initial ">The initial .</param>
25
25
/// <param name="max">The maximum.</param>
26
- public ExponentialRetryInterval ( TimeSpan first , TimeSpan max )
26
+ public ExponentialRetryInterval ( TimeSpan initial , TimeSpan ? max = null )
27
27
{
28
- _first = first ;
29
- _pre = first ;
30
- _maxDelay = max ;
28
+ _initial = initial ;
29
+ _pre = initial ;
30
+ _maxDelay = max ?? TimeSpan . MaxValue ;
31
31
32
32
_random = new Random ( ) ;
33
33
}
@@ -43,7 +43,7 @@ public TimeSpan GetInterval()
43
43
}
44
44
45
45
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 ) ;
47
47
48
48
_pre = TimeSpan . FromMilliseconds ( delay ) ;
49
49
Original file line number Diff line number Diff line change 8
8
<GenerateDocumentationFile >True</GenerateDocumentationFile >
9
9
<LangVersion >latest</LangVersion >
10
10
11
- <Version >0.3.0 </Version >
11
+ <Version >0.3.1 </Version >
12
12
<PackageId >$(AssemblyName)</PackageId >
13
13
<Description >A library for retrying operations.</Description >
14
14
<Authors >jerviscui</Authors >
You can’t perform that action at this time.
0 commit comments