I saw a new addition a few weeks ago to arrow wher...
# arrow
j
I saw a new addition a few weeks ago to arrow where you could specify a timeout/retry policy. I'm curious what an FP approach to designing a Circuit Breaker might look like. How might you keep your timeouts synchronized across your async layer without using side effects?
s
Hey, I think what you saw was
Schedule
, which is documented here. https://arrow-kt.io/docs/next/apidocs/arrow-fx-coroutines/arrow.fx.coroutines/-schedule/index.html And
CircuitBreaker
is documented here: https://arrow-kt.io/docs/next/apidocs/arrow-fx-coroutines/arrow.fx.coroutines/-circuit-breaker/index.html Although that documentation could use a little bit work 😅
The usage of side-effects is required for side-effects. It's a concurrency primitive in the lines of
Queue
,
MVar
etc where you deal with suspension, atomicity, etc In Arrow Fx this required
IO
or
F
constrained to
Concurrent
, but this is no longer necessary with an efficient
suspend
implementation 🙂
All feedback is very welcome!
j
The CircuitBreaker source actually has pretty good inline comments.
s
Thanks, I hope this was helpful 🙂 All feedback is welcome!