enhance: address suggestions from gabriel and zhiyuan

This commit is contained in:
Tienson Qin
2025-05-30 18:07:33 +08:00
parent 3bee73b62f
commit 06d7ed9b40
5 changed files with 12 additions and 8 deletions

View File

@@ -600,7 +600,7 @@
:fn #(repo-handler/fix-broken-graph! (state/get-current-repo))}
:dev/gc-graph {:binding []
:db-graph? true
:inactive (not (state/developer-mode?))
:fn #(repo-handler/gc-graph! (state/get-current-repo))}
:dev/replace-graph-with-db-file {:binding []

View File

@@ -251,10 +251,10 @@
(not (number? last-gc-at))
(> (- (common-util/time-ms) last-gc-at) (* 7 24 3600 1000))) ; 1 week ago
(prn :debug "gc current graph")
(sqlite-gc/gc-kvs-table! sqlite-db)
(doseq [db [sqlite-db client-ops-db]]
(sqlite-gc/gc-kvs-table! db))
(d/transact! datascript-conn [{:db/ident :logseq.kv/graph-last-gc-at
:kv/value (common-util/time-ms)}])))
(sqlite-gc/gc-kvs-table! client-ops-db))
:kv/value (common-util/time-ms)}]))))
(defn- create-or-open-db!
[repo {:keys [config import-type datoms] :as opts}]
@@ -734,7 +734,8 @@
(let [{:keys [db client-ops]} (get @*sqlite-conns repo)
conn (get @*datascript-conns repo)]
(when (and db conn)
(gc-sqlite-dbs! db client-ops conn {:from-user? true}))))
(gc-sqlite-dbs! db client-ops conn {:from-user? true})
nil)))
(comment
(def-thread-api :general/dangerousRemoveAllDbs

View File

@@ -788,7 +788,7 @@
:dev/replace-graph-with-db-file "(Dev) Replace graph with its db.sqlite file"
:dev/validate-db "(Dev) Validate current graph"
:dev/fix-broken-graph "Fix current broken graph"
:dev/gc-graph "Garbage collect graph (remove unused data in SQLite)"
:dev/gc-graph "(Dev) Garbage collect graph (remove unused data in SQLite)"
:dev/rtc-stop "(Dev) RTC Stop"
:dev/rtc-start "(Dev) RTC Start"
:window/close "Close window"}}