Skip to content

Commit

Permalink
Use :once true in fns used in wrap-bindings
Browse files Browse the repository at this point in the history
This is what `clojure.core/future` does.
  • Loading branch information
alexandergunnarson authored Nov 18, 2024
1 parent c099142 commit 05d73b4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/promesa/exec/csp.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
promise instance, has the same semantics as `go` macro."
[& body]
`(let [c# (chan :buf 1)
f# (px/wrap-bindings (fn [] ~@body))]
f# (px/wrap-bindings (^{:once true} fn* [] ~@body))]
(->> (p/thread-call *executor* f#)
(p/fnly (fn [v# e#]
(if e#
Expand All @@ -80,7 +80,7 @@
a promise instance."
[& body]
`(let [c# (chan :buf 1)
f# (px/wrap-bindings (fn [] ~@body))]
f# (px/wrap-bindings (^{:once true} fn* [] ~@body))]
(->> (p/thread-call :thread f#)
(p/fnly (fn [v# e#]
(if e#
Expand Down

0 comments on commit 05d73b4

Please sign in to comment.