File tree Expand file tree Collapse file tree 3 files changed +20
-6
lines changed Expand file tree Collapse file tree 3 files changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,23 @@ public RetryBuilder ConfigureOptions(Action<RetryOptions> configureAction)
108
108
return this ;
109
109
}
110
110
111
+ /// <summary>
112
+ /// Configures the RetryOptions.
113
+ /// </summary>
114
+ /// <param name="option">The retry option.</param>
115
+ /// <returns></returns>
116
+ public RetryBuilder ConfigureOptions ( RetryOptions option )
117
+ {
118
+ _configureAction = options =>
119
+ {
120
+ options . MaxTryCount = option . MaxTryCount ;
121
+ options . MaxTryTime = option . MaxTryTime ;
122
+ options . RetryInterval = option . RetryInterval ;
123
+ } ;
124
+
125
+ return this ;
126
+ }
127
+
111
128
/// <summary>
112
129
/// Retry only on exceptions of the type.
113
130
/// </summary>
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.1 </Version >
11
+ <Version >0.3.2 </Version >
12
12
<PackageId >$(AssemblyName)</PackageId >
13
13
<Description >A library for retrying operations.</Description >
14
14
<Authors >jerviscui</Authors >
Original file line number Diff line number Diff line change @@ -78,11 +78,8 @@ public async Task TryFunction_AsAsync_Test()
78
78
[ Fact ]
79
79
public void TryFunction_OverMaxTryTimeException_Test ( )
80
80
{
81
- var r = RetryBuilder . Default . ConfigureOptions ( options =>
82
- {
83
- options . MaxTryCount = int . MaxValue ;
84
- options . MaxTryTime = TimeSpan . FromSeconds ( 1 ) ;
85
- } ) . Build ( ( ) =>
81
+ var options = new RetryOptions { MaxTryCount = int . MaxValue , MaxTryTime = TimeSpan . FromSeconds ( 1 ) } ;
82
+ var r = RetryBuilder . Default . ConfigureOptions ( options ) . Build ( ( ) =>
86
83
{
87
84
throw new Exception ( ) ;
88
85
return 1 ;
You can’t perform that action at this time.
0 commit comments