This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-02-01
Channels
- # aleph (6)
- # announcements (37)
- # aws (1)
- # beginners (67)
- # calva (9)
- # clerk (5)
- # clj-kondo (3)
- # clojure (19)
- # clojure-europe (40)
- # clojure-nl (1)
- # clojure-norway (36)
- # clojure-uk (5)
- # clojuredesign-podcast (7)
- # clojurescript (28)
- # datomic (9)
- # emacs (8)
- # figwheel-main (4)
- # fulcro (6)
- # hyperfiddle (19)
- # integrant (4)
- # java (9)
- # lsp (131)
- # malli (9)
- # missionary (85)
- # off-topic (13)
- # pathom (3)
- # polylith (11)
- # releases (1)
- # sci (4)
- # shadow-cljs (7)
- # specter (2)
- # vscode (1)
- # xtdb (2)
I appreciate that Electric is db agnostic. But does anyone have any soft guidance about what state persistance would be a recommended natural fit for electric atm. Like if heavier DB’s impose extra considerations or limitation of the reactive nature. I don’t have a strong sense of what my requirements even are. But is it maybe more solid to stick to using atoms until I definitely need something else, .. or is it all the same for electric… fine to just use those, or Datascript, Datalevin, or Datomic, up the (datalog) tree. (specifically thinking about Datascript vs XTDB vs Datalevin… or none of the above? do I need a real db?). I remember some warnings about needing to get the db connections stuff right with missionary, and that ideally the db would be built with electric. Just wondering about current perspectives on the state of electric vs dbs from a starter perspective. Thx
we will be adding more datomic demos to electric fiddle and are quite happy with datomic onprem. which means it’s more likely that we already have any helpers you may need
@U09K620SG, I've seen a couple mentions of using Datomic's tx-report-queue
to reactively rerun queries, however it seemed to me that it was more of a fun trick that wasn't expected to scale, since every active query would have to rerun on every transaction. Is this the case, or are you using something like this in anger? (This is the first I've heard of your team using Datomic onprem specifically.)
I would've assumed this would require filtering new transactions for only those that would apply to each individual query, although perhaps Datomic's cache is efficient enough to do this for a reasonable amount of active queries?
nobody has come to us yet with this problem in practice, when a serious project presents with a real perf issue we will help work out the patterns. Remember, you can use missionary locally at any point to do things like locally throttle. even in a chat app like slack, most views are not realtime
and real-time apps have event based data layers anyway not databases
👍 All fair points
(Probably a case of trying to prematurely optimization on my part)
Q re: RCF: I have test running set up as described in https://github.com/hyperfiddle/rcf?tab=readme-ov-file#ci. However, when I run clojure -X:test ...
the process/terminal hangs with all tests passing. So, if I e.g. want to run tests as first of multiple scripts, the following scripts don't execute. Any ideas?
i haven't seen that before, can you send us a minimal repro?
are you using async rcf? maybe you hung a test
all assertions passed but it didn't complete
No. I think I have it:
(ns foo
(:require
[xtdb.api :as xt]
[hyperfiddle.rcf :refer [tests]]))
(def node (xt/start-node {}))
(tests
1 := 1)
;; hangs without this
#_(.close node)
A hacky workaround:
;; at end of ns, assuming no other test-generating ns uses `node`
(when (System/getProperty "hyperfiddle.rcf.generate-tests")
(println "closing node")
(.close node))
I don't know enough about these things, but it seems to me this is not an RCF issue.
I logged a ticket here: https://github.com/hyperfiddle/rcf/issues/83
I'm well out of context, but this issue & comment is possibly relevant https://github.com/xtdb/xtdb/issues/1882#issuecomment-1387131584
This seems to work well both for convenient REPL development (as long as you run the tests manually or through rcf
, i.e. clojure.test/run-tests
will close the node) and through test runners (exits properly).
(ns test
(:require
[xtdb.api :as xt]
[clojure.test :refer :all]
[hyperfiddle.rcf :refer [tests]]))
(def node (xt/start-node {}))
(xt/submit-tx node [[::xt/put {:xt/id 1}]])
(xt/sync node)
(use-fixtures :once
(fn [t]
(t)
(.close node)))
(deftest bar
(is (= (xt/entity (xt/db node) 1)
{:xt/id 1})))
(tests
(xt/entity (xt/db node) 1) := {:xt/id 1})