Skip to content

Instantly share code, notes, and snippets.

@JonCanning
Created January 12, 2015 12:55
Show Gist options
  • Select an option

  • Save JonCanning/78f6d5c651db5a5ad57a to your computer and use it in GitHub Desktop.

Select an option

Save JonCanning/78f6d5c651db5a5ad57a to your computer and use it in GitHub Desktop.
retry
let retry f =
let rec innerRetry f i =
try
f()
with
| ex when i > 0 ->
Syslog.Error ex
Syslog.Info("Retry no {0}", (i - 5) * -1)
Async.Sleep 1000 |> Async.RunSynchronously
innerRetry f <| i - 1
| ex -> raise ex
innerRetry f 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment