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

@@ -3,6 +3,7 @@
(:require [clojure.set :as set]
[clojure.string :as string]
[frontend.db :as db]
[frontend.db.model :as db-model]
[frontend.state :as state]
[frontend.util :as util]
[frontend.handler.property.util :as pu]
@@ -91,7 +92,7 @@
current-page (or (:block/name (db/get-current-page)) "")]
(when-let [repo (state/get-current-repo)]
(let [relation (db/get-pages-relation repo journal?)
tagged-pages (map (fn [[x y]] [x (common-util/page-name-sanity-lc y)]) (db/get-all-tagged-pages repo))
tagged-pages (map (fn [[x y]] [x (common-util/page-name-sanity-lc y)]) (db-model/get-all-tagged-pages repo))
namespaces (map (fn [[x y]] [x (common-util/page-name-sanity-lc y)]) (db/get-all-namespace-relation repo))
tags (set (map second tagged-pages))
full-pages (db/get-all-pages repo)