Skip to content

Instantly share code, notes, and snippets.

@explorer14
Created Jan 13, 2020
Embed
What would you like to do?
var policies = Policy
.Handle<MySqlException>(x => x.IsFailoverException())
.WaitAndRetry(5,
retry => TimeSpan.FromSeconds(retry * 5),
(a, b) =>
{
var mySqlEx = a as MySqlException;
Log.Logger.Warning(
"Failed with: {@error}. Retrying in {x} seconds...",
new
{
Msg = mySqlEx.Message,
Number = mySqlEx.Number,
HR = mySqlEx.HResult
},
b.TotalSeconds);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment