From b20c70fc2a6c7a747e645bd6c4e87ee659e23047 Mon Sep 17 00:00:00 2001 From: Nick Alexander Date: Thu, 13 Oct 2016 12:23:25 -0700 Subject: [PATCH] Review comment: ensure report is non-nil after in-transaction!. --- src/common/datomish/transact.cljc | 12 ++++++++---- test/datomish/transact_test.cljc | 12 ++++++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/common/datomish/transact.cljc b/src/common/datomish/transact.cljc index bc62ff05..68da51dc 100644 --- a/src/common/datomish/transact.cljc +++ b/src/common/datomish/transact.cljc @@ -586,7 +586,7 @@ (go (>! token-chan (gensym "transactor-token")) (loop [] - (let [token ( (! (:listener-source conn) report) + (when report + ;; ! (:listener-source conn) report)) report)))] + ;; Even when report is nil (transaction not committed), pair is non-nil. (>! result pair)) (>! token-chan token) (when close? diff --git a/test/datomish/transact_test.cljc b/test/datomish/transact_test.cljc index 1436eea9..34970f8b 100644 --- a/test/datomish/transact_test.cljc +++ b/test/datomish/transact_test.cljc @@ -209,4 +209,16 @@ (tempids r))) (is (= nil (a/poll! lc))))))) +(deftest-db test-failing-transacts conn + (let [{tx0 :tx} (