mirror of
https://github.com/logseq/logseq.git
synced 2026-06-01 19:01:22 +00:00
fix: don't update local tx to 0 except for two cases
1. creating a remote graph 2. uploading a local graph
This commit is contained in:
@@ -488,7 +488,7 @@
|
||||
(do
|
||||
(set-creating-db? true)
|
||||
(p/let [repo (repo-handler/new-db! graph-name
|
||||
{:remote-graph? cloud?})]
|
||||
{:creating-remote-graph? cloud?})]
|
||||
(when cloud?
|
||||
(->
|
||||
(p/do
|
||||
|
||||
@@ -132,13 +132,13 @@
|
||||
(let [full-graph-name (string/lower-case (str config/db-version-prefix graph-name))]
|
||||
(some #(= (some-> (:url %) string/lower-case) full-graph-name) (state/get-repos))))
|
||||
|
||||
(defn- create-db [full-graph-name {:keys [file-graph-import? remote-graph?]}]
|
||||
(defn- create-db [full-graph-name {:keys [file-graph-import? creating-remote-graph?]}]
|
||||
(->
|
||||
(p/let [config config/config-default-content
|
||||
_ (persist-db/<new full-graph-name
|
||||
(cond-> {:config config
|
||||
:graph-git-sha (build-version/revision)
|
||||
:remote-graph? remote-graph?}
|
||||
:creating-remote-graph? creating-remote-graph?}
|
||||
file-graph-import? (assoc :import-type :file-graph)))
|
||||
_ (start-repo-db-if-not-exists! full-graph-name)
|
||||
_ (state/add-repo! {:url full-graph-name :root (config/get-local-dir full-graph-name)})
|
||||
|
||||
@@ -408,7 +408,9 @@
|
||||
:skip-validate-db? true}))))
|
||||
|
||||
(defn- <create-or-open-db!
|
||||
[repo {:keys [config datoms sync-download-graph?] :as opts}]
|
||||
[repo {:keys [config datoms sync-download-graph? creating-remote-graph?] :as opts}]
|
||||
(when creating-remote-graph?
|
||||
(client-op/update-local-tx repo 0))
|
||||
(when-not (worker-state/get-sqlite-conn repo)
|
||||
(p/let [[db search-db client-ops-db :as dbs] (get-dbs repo)
|
||||
storage (new-sqlite-storage db)]
|
||||
@@ -453,14 +455,12 @@
|
||||
(when-not @*publishing?
|
||||
(client-op/ensure-sqlite-schema! client-ops-db))
|
||||
(ensure-client-ops-cleanup-timer! repo)
|
||||
(when (nil? (client-op/get-local-tx repo))
|
||||
(client-op/update-local-tx repo 0))
|
||||
(let [initial-tx-report (when-not (or initial-data-exists?
|
||||
(seq datoms)
|
||||
sync-download-graph?)
|
||||
(let [config (resolve-initial-config config)
|
||||
initial-data (sqlite-create-graph/build-db-initial-data
|
||||
config (select-keys opts [:import-type :graph-git-sha :remote-graph?]))]
|
||||
config (select-keys opts [:import-type :graph-git-sha :creating-remote-graph?]))]
|
||||
(ldb/transact! conn initial-data
|
||||
{:initial-db? true})))]
|
||||
(when-not sync-download-graph?
|
||||
|
||||
Reference in New Issue
Block a user