mirror of
https://github.com/logseq/logseq.git
synced 2026-06-01 19:01:22 +00:00
enhance: no need to block waiting previous graph server down
This commit is contained in:
@@ -102,7 +102,7 @@
|
||||
[{:keys [state start-daemon! stop-daemon! runtime-ready?] :as manager} repo window-id]
|
||||
(p/let [current-repo (get-in (ensure-state @state) [:window->repo window-id])
|
||||
_ (when (and current-repo (not= current-repo repo))
|
||||
(ensure-window-stopped! manager window-id))]
|
||||
(js/setTimeout #(ensure-window-stopped! manager window-id) 0))]
|
||||
(if-let [entry (get-in (ensure-state @state) [:repos repo])]
|
||||
(p/let [runtime (:runtime entry)
|
||||
ready? (runtime-ready? runtime)]
|
||||
|
||||
@@ -48,7 +48,8 @@
|
||||
[logseq.api.plugin :as plugin-api]
|
||||
[logseq.db.frontend.schema :as db-schema]
|
||||
[logseq.shui.ui :as shui]
|
||||
[promesa.core :as p]))
|
||||
[promesa.core :as p]
|
||||
[cljs-time.core :as t]))
|
||||
|
||||
;; TODO: should we move all events here?
|
||||
|
||||
@@ -121,12 +122,15 @@
|
||||
(search-plugin/call-service! service "search:rebuildBlocksIndice" {}))))))))
|
||||
|
||||
(defmethod handle :graph/switch [[_ graph opts]]
|
||||
(p/do!
|
||||
(export/cancel-db-backup!)
|
||||
(state/set-state! :db/async-queries {})
|
||||
(st/refresh!)
|
||||
(graph-switch-on-persisted graph opts)
|
||||
(export/backup-db-graph (state/get-current-repo))))
|
||||
(let [t1 (t/now)]
|
||||
(p/do!
|
||||
(export/cancel-db-backup!)
|
||||
(state/set-state! :db/async-queries {})
|
||||
(st/refresh!)
|
||||
(graph-switch-on-persisted graph opts)
|
||||
(export/backup-db-graph (state/get-current-repo))
|
||||
(let [t2 (t/now)]
|
||||
(log/info ::graph-switch-spent (- t2 t1))))))
|
||||
|
||||
(defmethod handle :graph/open-new-window [[_ev target-repo]]
|
||||
(ui-handler/open-new-window-or-tab! target-repo))
|
||||
|
||||
@@ -214,7 +214,8 @@
|
||||
|
||||
(defn backup-db-graph
|
||||
[repo]
|
||||
(when-not (util/capacitor?)
|
||||
(when (and util/web-platform?
|
||||
(not (util/capacitor?)))
|
||||
(web-backup-db-graph repo)))
|
||||
|
||||
(defonce *backup-interval (atom nil))
|
||||
|
||||
Reference in New Issue
Block a user