|
9 | 9 | [frontend.worker.rtc.client-op :as client-op] |
10 | 10 | [frontend.worker.rtc.const :as rtc-const] |
11 | 11 | [frontend.worker.rtc.exception :as r.ex] |
| 12 | + [frontend.worker.rtc.gen-client-op :as gen-client-op] |
12 | 13 | [frontend.worker.rtc.log-and-state :as rtc-log-and-state] |
13 | 14 | [frontend.worker.rtc.malli-schema :as rtc-schema] |
14 | 15 | [frontend.worker.rtc.remote-update :as r.remote-update] |
15 | 16 | [frontend.worker.rtc.skeleton :as r.skeleton] |
16 | 17 | [frontend.worker.rtc.throttle :as r.throttle] |
17 | 18 | [frontend.worker.rtc.ws :as ws] |
18 | 19 | [frontend.worker.rtc.ws-util :as ws-util] |
| 20 | + [lambdaisland.glogi :as log] |
19 | 21 | [logseq.db :as ldb] |
20 | 22 | [logseq.db.frontend.schema :as db-schema] |
21 | 23 | [missionary.core :as m] |
|
524 | 526 | ;; else |
525 | 527 | (do (rollback repo block-ops-map-coll update-kv-value-ops-map-coll rename-db-ident-ops-map-coll) |
526 | 528 | (throw (ex-info "Unavailable1" {:remote-ex remote-ex}))))) |
527 | | - |
528 | | - (do (assert (and (pos? (:t r)) (pos? (:t-query-end r))) r) |
529 | | - (m/? |
530 | | - (r.remote-update/task--apply-remote-update |
531 | | - graph-uuid repo conn date-formatter {:type :remote-update :value r} aes-key add-log-fn)) |
532 | | - (add-log-fn :rtc.log/push-local-update {:remote-t (:t r) :remote-t-query-end (:t-query-end r)})))))))) |
| 529 | + (if-let [not-found-target-ops (seq (:not-found-target-ops r))] |
| 530 | + (do (rollback repo block-ops-map-coll update-kv-value-ops-map-coll rename-db-ident-ops-map-coll) |
| 531 | + ;; add more ents into ops for remote |
| 532 | + (let [ents (mapv |
| 533 | + (fn [op] |
| 534 | + (let [block-uuid (:block-uuid (second op))] |
| 535 | + (assert block-uuid) |
| 536 | + (d/entity @conn [:block/uuid block-uuid]))) |
| 537 | + not-found-target-ops) |
| 538 | + extra-ops (gen-client-op/generate-rtc-ops-from-entities+parents ents)] |
| 539 | + (log/error :not-found-target-ops not-found-target-ops |
| 540 | + :extra-ops extra-ops) |
| 541 | + (client-op/add-ops! repo extra-ops))) |
| 542 | + |
| 543 | + (do (assert (and (pos? (:t r)) (pos? (:t-query-end r))) r) |
| 544 | + (m/? |
| 545 | + (r.remote-update/task--apply-remote-update |
| 546 | + graph-uuid repo conn date-formatter {:type :remote-update :value r} aes-key add-log-fn)) |
| 547 | + (add-log-fn :rtc.log/push-local-update {:remote-t (:t r) :remote-t-query-end (:t-query-end r)}))))))))) |
533 | 548 |
|
534 | 549 | (defn new-task--pull-remote-data |
535 | 550 | [repo conn graph-uuid major-schema-version date-formatter get-ws-create-task aes-key add-log-fn] |
|
0 commit comments