This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-05-11
Channels
- # announcements (16)
- # architecture (1)
- # babashka (24)
- # beginners (49)
- # biff (5)
- # calva (13)
- # clerk (3)
- # clj-kondo (4)
- # clojure (46)
- # clojure-dev (1)
- # clojure-europe (22)
- # clojure-losangeles (5)
- # clojure-nl (1)
- # clojure-norway (15)
- # clojure-uk (2)
- # clojurescript (28)
- # code-reviews (2)
- # community-development (6)
- # conjure (10)
- # cursive (8)
- # datalevin (15)
- # datomic (32)
- # events (1)
- # fulcro (9)
- # hyperfiddle (32)
- # introduce-yourself (1)
- # lsp (27)
- # malli (1)
- # matrix (3)
- # missionary (6)
- # off-topic (24)
- # practicalli (2)
- # rdf (1)
- # re-frame (7)
- # reagent (10)
- # reitit (5)
- # rewrite-clj (9)
- # sci (6)
- # scittle (4)
- # shadow-cljs (23)
- # tools-deps (74)
- # vim (19)
- # xtdb (5)
Hi! I continue my learning on missionary and I try to create a flow in order to observe datomic report queue but I have a mistake. I try this code:
(def f (->> (m/observe (fn [!]
(! (d/tx-report-queue conn))
#(d/remove-tx-report-queue conn)))
(m/relieve {})
(m/latest (fn [_] (d/db conn)))))
(m/? (m/reduce conj f))
But when a run the task the process block the repl and doesn’t response. I don’t see why.The repl is blocked because the process never terminates, which is expected.
I don't recommend using blocking m/?
at the repl because most of them (if not all) don't support interrupting a pending evaluation. Use callbacks instead :
(def cancel ((m/reduce conj f) #(prn :success %) #(prn :failure %)))
;; process is running now
(cancel)
Hello. I miss something here because the process block the repl:
(def poll-queue (m/sp (.poll ^LinkedBlockingQueue tx-queue)))
(def polling
(m/ap
(loop []
(m/amb (m/? poll-queue)
(recur)))))
(def run (->> polling
(m/eduction (remove nil?))
(m/reduce (fn [_ item]
(println 'poll item)
item)
nil)))
(def cancel-run (run #(prn %) #(prn %)))
It’s the polling
flow is good here?