Last active
January 9, 2019 13:05
-
-
Save CoditCompany/a4129d7f6c4212e66f75f62e5ab36ccc 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
open FScenario | |
// Polling Computation Expression | |
pol { target (fun () -> async { return FileInfo "C:/temp/file.txt" }) | |
until (fun f -> f.Exists) | |
every _1s | |
timeout _5s | |
error "Polling at file path 'C:/temp/file.txt' doesn't result in any file" } | |
// Pipable polling functions | |
Poll.target (fun () -> Http.get "http://localhost:9090") | |
|> Poll.until (fun r -> r.StatusCode = OK) | |
|> Poll.every _5s | |
|> Poll.timeout _30s | |
|> Poll.error "Polling at http endpoint 'http://localhost:9090' doesn't result in OK" | |
// Prepared polling functions | |
Poll.untilFileExistsEvery1sFor5s "C:/temp/file.txt" | |
Poll.untilHttpOkEvery5sFor30s "http://localhost:9090" | |
Poll.untilEvery1sFor5s (fun () -> async { return 0 }) (fun i -> i = 0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment