Exponential backoff retry logic
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

ocaml-retry: bind callbacks in README examples

[Eio.Net.Connection_refused] isn't a constructor of [exn] (the eio
exception is wrapped via Eio.Io); the example also referenced
unbound [connect_to_server] / [call_api]. Use a generic [Failure _]
predicate and pass the side-effecting callbacks as parameters
([~connect_to_server], [~call_api]).

+4 -3
+4 -3
README.md
··· 28 28 29 29 ```ocaml 30 30 let config = Retry.config ~max_retries:5 () 31 + 31 32 let should_retry = function 32 - | Eio.Net.Connection_refused _ -> true 33 + | Failure _ -> true 33 34 | _ -> false 34 35 35 - let run ~clock = 36 + let run ~clock ~connect_to_server = 36 37 Retry.with_retry ~clock ~config ~should_retry (fun () -> 37 38 connect_to_server ()) 38 39 ``` ··· 40 41 ### Retry on `Error` result 41 42 42 43 ```ocaml 43 - let run ~clock = 44 + let run ~clock ~call_api = 44 45 Retry.with_retry_result ~clock ~config 45 46 ~should_retry:(function `Unavailable -> true | _ -> false) 46 47 (fun () -> call_api ())