Fork me on GitHub
#missionary
<
2024-03-29
>
J08:03:50

Hi guys! What is the convention to adopt in the codebase with a lot of missionary task? For example consider the following example:

;; Let the caller apply the missionary wrapper

(defn function-1 [] ...)

(def main
  (m/sp
    (let [res-1 (m/? (m/sp (function-1)))]

;; Or provide extra function to do the job

(defn function-1 [] ...)
(defn ?function-1 [] (m/? (m/sp (function-1)))

(def main
  (m/sp
    (let [res-1 (?function-1)])
  

leonoel13:03:23

Let the caller choose. It's always possible to turn an asynchronous task into a synchronous one but the opposite is not true, so async should be the default

👍 2
Andrew Wilcox23:03:06

From the documentation, it looks like there isn't a way to terminate the flow created by observe ? The flow can be cancelled of course, but there isn't a way to have it act like e.g. (seed [1 2 3]), i.e. output some values and then terminate without cancellation? (It's fine if not, there's other ways to do it of course, just wanted to check my understanding).

leonoel08:03:14

correct

🙏 1