Skip to content

Commit 36fd248

Browse files
committed
conn support skip-store?
1 parent 3971e2d commit 36fd248

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

src/datascript/conn.cljc

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -81,22 +81,23 @@
8181

8282
(defn ^:no-doc store-after-transact!
8383
[conn tx-report]
84-
(when-some [storage (storage/storage @conn)]
85-
(let [{db :db-after
86-
datoms :tx-data} tx-report
87-
settings (set/settings (:eavt db))
88-
*atom (:atom conn)
89-
tx-tail' (:tx-tail (swap! *atom update :tx-tail conj datoms))]
90-
(when-not (get-in tx-report [:tx-meta :skip-store?])
91-
(if (> (transduce (map count) + 0 tx-tail') (:branching-factor settings))
92-
;; overflow tail
93-
(do
94-
(storage/store-impl! db (storage/storage-adapter db) false)
95-
(swap! *atom assoc
96-
:tx-tail []
97-
:db-last-stored db))
98-
;; just update tail
99-
(storage/store-tail db tx-tail'))))))
84+
(when-not (:skip-store? @conn)
85+
(when-some [storage (storage/storage @conn)]
86+
(let [{db :db-after
87+
datoms :tx-data} tx-report
88+
settings (set/settings (:eavt db))
89+
*atom (:atom conn)
90+
tx-tail' (:tx-tail (swap! *atom update :tx-tail conj datoms))]
91+
(when-not (get-in tx-report [:tx-meta :skip-store?])
92+
(if (> (transduce (map count) + 0 tx-tail') (:branching-factor settings))
93+
;; overflow tail
94+
(do
95+
(storage/store-impl! db (storage/storage-adapter db) false)
96+
(swap! *atom assoc
97+
:tx-tail []
98+
:db-last-stored db))
99+
;; just update tail
100+
(storage/store-tail db tx-tail')))))))
100101

101102
(defn ^:no-doc -transact! [conn tx-data tx-meta]
102103
{:pre [(conn? conn)]}

0 commit comments

Comments
 (0)