Skip to content

Commit c6e01a6

Browse files
committed
Fix bugs.
1 parent b3831bd commit c6e01a6

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

Source/TransientFaultHandling.Configuration.Core/RetryStrategyOptions.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ public abstract record RetryStrategyOptions(bool FastFirstRetry);
1010
/// </summary>
1111
public record FixedIntervalOptions(bool FastFirstRetry, int RetryCount, TimeSpan RetryInterval) : RetryStrategyOptions(FastFirstRetry)
1212
{
13-
private readonly int retryCount;
13+
private readonly int retryCount = RetryCount.ThrowIfNegative();
1414

15-
private readonly TimeSpan retryInterval;
15+
private readonly TimeSpan retryInterval = RetryInterval.ThrowIfNegative();
1616

1717
/// <summary>
1818
/// Initializes a new instance of the <see cref="FixedIntervalOptions" /> record.
@@ -45,11 +45,11 @@ public TimeSpan RetryInterval
4545
/// </summary>
4646
public record IncrementalOptions(bool FastFirstRetry, int RetryCount, TimeSpan InitialInterval, TimeSpan Increment) : RetryStrategyOptions(FastFirstRetry)
4747
{
48-
private readonly int retryCount;
48+
private readonly int retryCount = RetryCount.ThrowIfNegative();
4949

50-
private readonly TimeSpan initialInterval;
50+
private readonly TimeSpan initialInterval = InitialInterval.ThrowIfNegative();
5151

52-
private readonly TimeSpan increment;
52+
private readonly TimeSpan increment = Increment.ThrowIfNegative();
5353

5454
/// <summary>
5555
/// Initializes a new instance of the <see cref="IncrementalOptions" /> record.
@@ -91,13 +91,13 @@ public TimeSpan Increment
9191
/// </summary>
9292
public record ExponentialBackoffOptions(bool FastFirstRetry, int RetryCount, TimeSpan MinBackOff, TimeSpan MaxBackOff, TimeSpan DeltaBackOff) : RetryStrategyOptions(FastFirstRetry)
9393
{
94-
private readonly int retryCount;
94+
private readonly int retryCount = RetryCount.ThrowIfNegative();
9595

96-
private readonly TimeSpan minBackOff;
96+
private readonly TimeSpan minBackOff = MinBackOff.ThrowIfOutOfRange(TimeSpan.Zero, MaxBackOff);
9797

98-
private readonly TimeSpan maxBackOff;
98+
private readonly TimeSpan maxBackOff = MaxBackOff.ThrowIfNegative();
9999

100-
private readonly TimeSpan deltaBackOff;
100+
private readonly TimeSpan deltaBackOff = DeltaBackOff.ThrowIfNegative();
101101

102102
/// <summary>
103103
/// Initializes a new instance of the <see cref="ExponentialBackoffOptions" /> record.
@@ -120,7 +120,7 @@ public int RetryCount
120120
/// </summary>
121121
public TimeSpan MinBackOff
122122
{
123-
get => this.minBackOff;
123+
get => this.minBackOff.ThrowIfOutOfRange(TimeSpan.Zero, this.maxBackOff);
124124
init => this.minBackOff = value.ThrowIfNegative();
125125
}
126126

0 commit comments

Comments
 (0)