Rsft.EntLib.TransientFaultHandling.Standard by Rolosoft Ltd

<PackageReference Include="Rsft.EntLib.TransientFaultHandling.Standard" Version="7.0.0" />

 Incremental

public class Incremental : RetryStrategy
A retry strategy with a specified number of retry attempts and an incremental time interval between retries.
using System; namespace Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling { public class Incremental : RetryStrategy { private readonly int retryCount; private readonly TimeSpan initialInterval; private readonly TimeSpan increment; public Incremental() : this(RetryStrategy.DefaultClientRetryCount, RetryStrategy.DefaultRetryInterval, RetryStrategy.DefaultRetryIncrement) { } public Incremental(int retryCount, TimeSpan initialInterval, TimeSpan increment) : this(null, retryCount, initialInterval, increment) { } public Incremental(string name, int retryCount, TimeSpan initialInterval, TimeSpan increment) : this(name, retryCount, initialInterval, increment, RetryStrategy.DefaultFirstFastRetry) { } public Incremental(string name, int retryCount, TimeSpan initialInterval, TimeSpan increment, bool firstFastRetry) : base(name, firstFastRetry) { Guard.ArgumentNotNegativeValue(retryCount, "retryCount"); Guard.ArgumentNotNegativeValue(initialInterval.Ticks, "initialInterval"); Guard.ArgumentNotNegativeValue(increment.Ticks, "increment"); this.retryCount = retryCount; this.initialInterval = initialInterval; this.increment = increment; } public override ShouldRetry GetShouldRetry() { return delegate(int currentRetryCount, Exception lastException, out TimeSpan retryInterval) { if (currentRetryCount < retryCount) { TimeSpan timeSpan = initialInterval; double totalMilliseconds = timeSpan.TotalMilliseconds; timeSpan = increment; retryInterval = TimeSpan.FromMilliseconds(totalMilliseconds + timeSpan.TotalMilliseconds * (double)currentRetryCount); return true; } retryInterval = TimeSpan.Zero; return false; }; } } }