diff --git a/src/common/datomish/transact.cljc b/src/common/datomish/transact.cljc index 58e0d33a..bc62ff05 100644 --- a/src/common/datomish/transact.cljc +++ b/src/common/datomish/transact.cljc @@ -570,13 +570,16 @@ "Submits a transaction to the database for writing. Returns a pair-chan resolving to `[result error]`." - [conn tx-data] - {:pre [(conn? conn)]} - (let [result (a/chan 1)] - ;; Any race to put! is a real race between callers of ! token-chan (gensym "transactor-token")) (loop [] (let [token (! (:listener-source conn) report) report)))] (>! result pair)) - (a/close! result) (>! token-chan token) + (when close? + (a/close! result)) (recur))))))) (defn listen-chan! diff --git a/test/datomish/transact_test.cljc b/test/datomish/transact_test.cljc index 05e28698..1436eea9 100644 --- a/test/datomish/transact_test.cljc +++ b/test/datomish/transact_test.cljc @@ -98,8 +98,8 @@ ;; Wait for all transactions to complete. (