Skip to content

Instantly share code, notes, and snippets.

@JayBazuzi
Created August 25, 2016 19:39
Show Gist options
  • Save JayBazuzi/607629e617a3c9e8194dd7cc7b96bbe0 to your computer and use it in GitHub Desktop.
Save JayBazuzi/607629e617a3c9e8194dd7cc7b96bbe0 to your computer and use it in GitHub Desktop.
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