Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let rnd = System.Random()
- let work x () =
- if rnd.Next(2) = 1 then failwith "Bang"
- printfn "Working %d" x
- let rec retry f = async {
- try f()
- with e ->
- printfn "Retrying"
- do! Async.Sleep 500
- return! retry f
- }
- let task =
- [for i in 1..10 -> work i |> retry]
- |> Async.Parallel
- do Async.RunSynchronously(task, timeout=1000)
- |> ignore
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement