Skip to content

Instantly share code, notes, and snippets.

@mvodep
Created April 30, 2019 10:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mvodep/b3d8946bbd369b4a2c1dc2c5619fcb8b to your computer and use it in GitHub Desktop.
Save mvodep/b3d8946bbd369b4a2c1dc2c5619fcb8b to your computer and use it in GitHub Desktop.
// Retry, waiting a specified duration between each retry,
// calling an action on each retry with the current exception,
// duration and context provided to Execute()
Policy
.Handle<SomeExceptionType>()
.WaitAndRetry(new[]
{
TimeSpan.FromSeconds(1),
TimeSpan.FromSeconds(2),
TimeSpan.FromSeconds(3)
}, (exception, timeSpan, context) => {
// do something
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment