Fork me on GitHub

i'm pretty new to datomic and not sure if i'm asking the "right" question, but maybe someone can help? i have two apps that use datomic (cloud). one app is responsible for authenticating a user and then linking them to some entity in datomic. the other app kicks off this process, gets back a confirmation that some datoms were updated, and then queries for that linked entity. the first time the query runs i get back nothing, and then all subsequent queries return the linked value. how asynchronous is transacting vs. reading?


or in other words, how can i guarantee that another peer/client has immediate access to the data after a transaction has occurred?


@joshkh have a look at the sync fn discussed literally just before you posted a question


@joshkh you can do something like

;; On srv1
(let [tx-data (do-auth-stuff request)
      {:keys [db-after]} @(d/transact conn tx-data)
      basis-t (d/basis-t db-after)]
  (send-to-srv-2 basis-t))

;; On srv2
(let [db @(d/sync conn basis-t)]
  (do-srv2-stuff db ...))
Then, db on srv2 will "wait" to a db with this basis-t. But as @misha said, d/sync without a t will ask the transactor "the newst db at this time"


cheers, thanks! i'll give it a whirl.


out of curiosity, is d/sync only available on-prem and not applicable to datomic cloud? i see it here: but not here: