Fork me on GitHub
#missionary
<
2024-04-17
>
Andrew Wilcox00:04:30

Here's a utility I've found helpful for debugging tasks and flows: https://gist.github.com/awwx/ab23234a7d3d43cf83003f3bf41937c7 It wraps a task or flow and reports on events: cancellation, task success or failure, flow notification and transfer, etc. I use it when I have a task or flow buried in the middle of my program and I need to find out if it's being canceled or not as I expect, whether it's throwing Cancelled or not, whether it's succeeding or failure or producing values.

((m/reduce {} nil
   (observe-flow "seed" (m/seed [1 2 3 4])))
 #(prn %) #(prn %))

seed :notified
seed :instantiated
seed :notified
seed :transferred-value 1
seed :notified
seed :transferred-value 2
seed :notified
seed :transferred-value 3
seed :terminated
seed :transferred-value 4
4

🙌 3
😲 3
👍 3
Eric Dvorsak09:04:36

Amazing thanks for sharing!