This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-08-21
Channels
- # aleph (2)
- # beginners (22)
- # boot (7)
- # chestnut (8)
- # cider (4)
- # clara (3)
- # cljs-dev (3)
- # cljs-experience (19)
- # clojure (69)
- # clojure-italy (8)
- # clojure-nl (1)
- # clojure-spec (11)
- # clojure-uk (17)
- # clojurescript (77)
- # cursive (22)
- # datomic (14)
- # events (1)
- # fulcro (78)
- # hoplon (51)
- # jobs (3)
- # keechma (1)
- # lambdaisland (1)
- # lumo (30)
- # off-topic (42)
- # om (22)
- # onyx (5)
- # parinfer (4)
- # portkey (1)
- # re-frame (15)
- # reagent (2)
- # ring (4)
- # spacemacs (1)
- # specter (23)
- # testing (1)
- # unrepl (60)
- # yada (8)
I have a process which continuously pulls data from a source and writes it to Datomic. Most of the time the data stays the same, so only the tx datoms are asserted. However, I don’t care about capturing empty txs and they seem to take up a lot of the space in the db. What’s the best way to not record empty txs/prune them from the db periodically? I know I could 1) dump the db and reimport the data periodically - not great; 2) check if the tx-data to be asserted is exactly the same - would like not to do the work if can be avoided. Are there any better solutions?
@dm3 one thought that pops into my head is to wrap it all in a transactor function, and wrap the entire transaction in it. That function can use "with" and look at db-after to see if anything actually changed
so a transaction will look something like [[:ignore-noop .... normal tx data here ...]]
then you could throw an error and use ex-info to determine that it was in fact just a noop, not an error
since afaik using exceptions is the only way to abort a transaction in a transaction function, you can't use normal control flow
@dm3 note that depending on your system, it might be fine to do that check on the peer (e.g. query the database and check if your data has changed)
if it’s a periodic job and you know for fact that two jobs won’t be running concurrently you won’t have race conditions etc