public static void Main()
for (var i = 0; i < 100; ++i)
Console.WriteLine("{0} {1}", i, p.GetRestartDelay());
public TimeSpan InitialRestartDelay = TimeSpan.FromSeconds(30);
public TimeSpan MaximumRestartWait = TimeSpan.FromMinutes(10);
TimeSpan GetRestartDelay()
var restartDelaySeconds = this.InitialRestartDelay.TotalSeconds * Math.Pow(2.0, this.restartCount - 1);
restartDelaySeconds = Math.Min(MaximumRestartWait.TotalSeconds, restartDelaySeconds);
return TimeSpan.FromSeconds(restartDelaySeconds);