mirror of https://github.com/logseq/logseq
refactor(rtc): remake rtc-request-download-graph
parent
0164695483
commit
1db86be435
|
@ -611,11 +611,7 @@
|
||||||
;; ================================================================
|
;; ================================================================
|
||||||
(rtc-request-download-graph
|
(rtc-request-download-graph
|
||||||
[this token graph-uuid]
|
[this token graph-uuid]
|
||||||
(async-util/c->p
|
(js/Promise. (rtc-core2/new-task--request-download-graph token graph-uuid)))
|
||||||
(async/go
|
|
||||||
(let [state (or @rtc-core/*state
|
|
||||||
(<! (rtc-core/<init-state token false)))]
|
|
||||||
(<? (rtc-updown/<request-download-graph state graph-uuid))))))
|
|
||||||
|
|
||||||
(rtc-wait-download-graph-info-ready
|
(rtc-wait-download-graph-info-ready
|
||||||
[this repo token download-info-uuid graph-uuid timeout-ms]
|
[this repo token download-info-uuid graph-uuid timeout-ms]
|
||||||
|
|
|
@ -308,6 +308,13 @@
|
||||||
(r.ex/->map (ex-info "Not found db-conn" {:type :rtc.exception/not-found-db-conn
|
(r.ex/->map (ex-info "Not found db-conn" {:type :rtc.exception/not-found-db-conn
|
||||||
:repo repo})))))
|
:repo repo})))))
|
||||||
|
|
||||||
|
(defn new-task--request-download-graph
|
||||||
|
[token graph-uuid]
|
||||||
|
(let [{:keys [get-ws-create-task]} (new-task--get-ws-create--memoized (get-ws-url token))]
|
||||||
|
(r.upload-download/new-task--request-download-graph get-ws-create-task graph-uuid)))
|
||||||
|
|
||||||
|
;;; ================ API (ends) ================
|
||||||
|
|
||||||
;;; subscribe debug state ;;;
|
;;; subscribe debug state ;;;
|
||||||
|
|
||||||
(defonce ^:private *last-subscribe-canceler (atom nil))
|
(defonce ^:private *last-subscribe-canceler (atom nil))
|
||||||
|
|
|
@ -71,7 +71,7 @@
|
||||||
(throw (ex-info "upload-graph failed" {:upload-resp upload-resp})))))))
|
(throw (ex-info "upload-graph failed" {:upload-resp upload-resp})))))))
|
||||||
|
|
||||||
|
|
||||||
(def block-type-kw->str
|
(def ^:private block-type-kw->str
|
||||||
{:block-type/property "property"
|
{:block-type/property "property"
|
||||||
:block-type/class "class"
|
:block-type/class "class"
|
||||||
:block-type/whiteboard "whiteboard"
|
:block-type/whiteboard "whiteboard"
|
||||||
|
@ -177,13 +177,11 @@
|
||||||
;; async download-graph ;;
|
;; async download-graph ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(defn <request-download-graph
|
(defn new-task--request-download-graph
|
||||||
[state graph-uuid]
|
[get-ws-create-task graph-uuid]
|
||||||
(go-try
|
(m/join :download-info-uuid
|
||||||
(let [{:keys [download-info-uuid]}
|
(r.client/send&recv get-ws-create-task {:action "download-graph"
|
||||||
(<? (ws/<send&receive state {:action "download-graph"
|
:graph-uuid graph-uuid})))
|
||||||
:graph-uuid graph-uuid}))]
|
|
||||||
download-info-uuid)))
|
|
||||||
|
|
||||||
(defn <wait-download-info-ready
|
(defn <wait-download-info-ready
|
||||||
[state download-info-uuid graph-uuid timeout-ms]
|
[state download-info-uuid graph-uuid timeout-ms]
|
||||||
|
|
Loading…
Reference in New Issue