Skip to content

Commit 3963f75

Browse files
authored
Merge pull request #231 from tanzoniteblack/ryan/core-async-1.6.673
Upgrade to core.async 1.6.673
2 parents abc37c4 + ef9038a commit 3963f75

File tree

3 files changed

+20
-10
lines changed

3 files changed

+20
-10
lines changed

.circleci/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,4 @@ jobs:
4040

4141
# run tests!
4242
- run: lein do clean, test
43+
- run: lein with-profile +older-core-async do clean, test manifold.go-off-test

project.clj

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@
88
[org.clojure/tools.logging "1.2.4" :exclusions [org.clojure/clojure]]
99
[org.clj-commons/dirigiste "1.0.3"]
1010
[riddley "0.2.0"]
11-
[org.clojure/core.async "1.5.648" :scope "provided"]
11+
[org.clojure/core.async "1.6.673" :scope "provided"]
1212
[potemkin "0.4.6"]]
13-
:profiles {:dev {:dependencies [[criterium "0.4.6"]]}}
13+
:profiles {:dev {:dependencies [[criterium "0.4.6"]]}
14+
;; core.async moved around some internal functions go-off relies on; this profile
15+
;; helps test that go-off still works both with the new namespaces and the old
16+
:older-core-async {:dependencies [[org.clojure/core.async "1.5.648" :scope "provided"]]}}
1417
:test-selectors {:default #(not
1518
(some #{:benchmark :stress}
1619
(cons (:tag %) (keys %))))

src/manifold/go_off.clj

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,14 @@
1010
[manifold.stream :as s])
1111
(:import (manifold.stream.core IEventSource)))
1212

13+
;; a number of functions from `ioc-macros` moved to `runtime` in org.clojure/core.async "1.6.673"
14+
;; since they were just moved without functionality changes, continue to support both via dynamic import
15+
(if (find-ns 'clojure.core.async.impl.runtime)
16+
(require '[clojure.core.async.impl.runtime :as async-runtime])
17+
(require '[clojure.core.async.impl.ioc-macros :as async-runtime]))
18+
1319
(defn ^:no-doc return-deferred [state value]
14-
(let [d (ioc/aget-object state ioc/USER-START-IDX)]
20+
(let [d (async-runtime/aget-object state async-runtime/USER-START-IDX)]
1521
(d/success! d value)
1622
d))
1723

@@ -38,28 +44,28 @@
3844
r#)))
3945

4046
(defn ^:no-doc run-state-machine-wrapped [state]
41-
(try (ioc/run-state-machine state)
47+
(try (async-runtime/run-state-machine state)
4248
(catch Throwable ex
43-
(d/error! (ioc/aget-object state ioc/USER-START-IDX) ex)
49+
(d/error! (async-runtime/aget-object state async-runtime/USER-START-IDX) ex)
4450
(throw ex))))
4551

4652
(defn ^:no-doc take! [state blk d]
4753
(let [handler (fn [x]
48-
(ioc/aset-all! state ioc/VALUE-IDX x ioc/STATE-IDX blk)
54+
(async-runtime/aset-all! state async-runtime/VALUE-IDX x async-runtime/STATE-IDX blk)
4955
(run-state-machine-wrapped state))
5056
;; if `d` is a stream, use `take` to get a deferrable that we can wait on
5157
d (if (instance? IEventSource d) (s/take! d) d)
5258
d-is-deferrable? (d/deferrable? d)]
5359
(if
5460
;; if d is not deferrable immediately resume processing state machine
5561
(not d-is-deferrable?)
56-
(do (ioc/aset-all! state ioc/VALUE-IDX d ioc/STATE-IDX blk)
62+
(do (async-runtime/aset-all! state async-runtime/VALUE-IDX d async-runtime/STATE-IDX blk)
5763
:recur)
5864
(let [d (d/->deferred d)]
5965
(if
6066
;; if already realized, deref value and immediately resume processing state machine
6167
(d/realized? d)
62-
(do (ioc/aset-all! state ioc/VALUE-IDX @d ioc/STATE-IDX blk)
68+
(do (async-runtime/aset-all! state async-runtime/VALUE-IDX @d async-runtime/STATE-IDX blk)
6369
:recur)
6470

6571
;; resume processing state machine once d has been realized
@@ -84,8 +90,8 @@
8490
(let [~@(mapcat (fn [[l sym]] [sym `(^:once fn* [] ~(vary-meta l dissoc :tag))]) crossing-env)
8591
f# ~(ioc/state-machine `(do ~@body) 1 [crossing-env &env] async-custom-terminators)
8692
state# (-> (f#)
87-
(ioc/aset-all! ioc/USER-START-IDX d#
88-
ioc/BINDINGS-IDX captured-bindings#))]
93+
(async-runtime/aset-all! async-runtime/USER-START-IDX d#
94+
async-runtime/BINDINGS-IDX captured-bindings#))]
8995
(run-state-machine-wrapped state#))))
9096
;; chain is8 being used to apply unwrap chain
9197
(d/chain d#)))

0 commit comments

Comments
 (0)