Source/Common/Core/FileOperations/RetryLoop.cs
/// <summary>
/// Retries func until it succeeds or the specified maximum number of attempts is reached
/// This function will sleep 2^i ms between each attempt.
/// </summary>
/// <exception cref="AggregateException"></exception>
Retries func until it succeeds or the specified maximum number of attempts is reached
This function will sleep 2^i ms between each attempt.
Retries func until it succeeds or the specified maximum number of attempts is reached This function will sleep 2^i ms between each attempt .
public static T Try<T>(
			int maxAttempts,
			Func<T> func,
			Func<int, TimeSpan> sleepFunction = null)
		{
			sleepFunction = sleepFunction ?? SleepFunctions.DiskRetry;
			return LoopUntilSuccess(_ => func(), sleepFunction, maxAttempts);
		}
public static T Try < T > ( int maxAttempts , Func < T > func , Func < int , TimeSpan > sleepFunction = null ) { sleepFunction = sleepFunction ?? SleepFunctions . DiskRetry ; return LoopUntilSuccess ( _ => func ( ) , sleepFunction , maxAttempts ) ; }
Retries func until it succeeds or the specified maximum number of attempts is reached
This function will sleep 2^i ms between each attempt.
Retries func until it succeeds or the specified maximum number of attempts is reached This function will sleep 2^i ms between each attempt .
None
maxAttempts
int
func
Func<T>
sleepFunction
Func<int, TimeSpan>