perf: db reload

Load as less pages && closed values as we can to avoid loading too
much data.

We already know that transacting db attributes is slow, going to
investigate it later.
This commit is contained in:
Tienson Qin
2024-04-22 22:05:31 +08:00
parent 6b3a9f4f4c
commit a15066c862
19 changed files with 217 additions and 195 deletions

View File

@@ -22,16 +22,16 @@
(defn <uuid->uid-map []
(let [repo (state/get-current-repo)]
(p/let [result (db-async/<q repo
(p/let [result (db-async/<q repo {:transact-db? false}
'[:find (pull ?r [:block/uuid])
:in $
:where
[?b :block/refs ?r]])]
(->> result
(map (comp :block/uuid first))
(distinct)
(map (fn [uuid] [uuid (nano-id)]))
(into {})))))
(map (comp :block/uuid first))
(distinct)
(map (fn [uuid] [uuid (nano-id)]))
(into {})))))
(defn update-content [content uuid->uid-map]
(when content ; page block doesn't have content