Created
August 25, 2016 19:39
-
-
Save JayBazuzi/607629e617a3c9e8194dd7cc7b96bbe0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const int RetryAttempts = 5; | |
const int RetryIntervalSeconds = 8; | |
static FooResults FooClientExecuteCommand(FooClient client, string command) | |
{ | |
FooResults results = null; | |
for (var i = 0; i <= RetryAttempts; i++) | |
{ | |
try | |
{ | |
results = client.Execute(command); | |
break; | |
} | |
catch (Exception e) | |
{ | |
if (i == RetryAttempts) | |
{ | |
throw new FooClientException("Message: '" + e.Message + "' Type: '" + e.GetType() + "'."); | |
} | |
Thread.Sleep(RetryIntervalSeconds*1000); | |
} | |
} | |
return results; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment