Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: concurrent resolution should not happen. #1651

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix: concurrent resolution should not happen.
neotyk committed Sep 14, 2021

Verified

This commit was signed with the committer’s verified signature.
neotyk Alex Iwaniuk
commit 698913ec7dda9330eb891392e323600c5480d9af
8 changes: 6 additions & 2 deletions src/clj/athens/self_hosted/web/datascript.clj
Original file line number Diff line number Diff line change
@@ -75,10 +75,14 @@
(common-events/build-event-rejected event-id err-msg err-data)))))


(def single-writer-guard (Object.))


(defn default-handler
[datahike _channel {:event/keys [id] :as event}]
(let [txs (resolver/resolve-event-to-tx @datahike event)]
(transact! datahike id txs)))
(locking single-writer-guard
(let [txs (resolver/resolve-event-to-tx @datahike event)]
(transact! datahike id txs))))


(defn datascript-handler