Last active
July 27, 2018 13:08
-
-
Save marraia/832f77c67dbd2185d4b597edaea48fc1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private RetryPolicy WaitRetryPolicyPolly() | |
{ | |
return Policy.Handle<HttpRequestException>() | |
.WaitAndRetry( | |
//Quantidade de vezes de re-tentativas | |
3, | |
//Tempo de espera para a próxima requisição | |
retryAttempt => TimeSpan.FromSeconds(30), | |
(exception, timeSpan, retryCount, context) => | |
{ | |
var msg = $"Retry {retryCount} implemented with Pollys RetryPolicy " + | |
$"of {context.PolicyKey} " + | |
$"at {context.ExecutionKey}, " + | |
$"due to: {exception}."; | |
_log.LogWarning(msg); | |
} | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment