Browse Source

chore(rtc): update log

rcmerci 3 months ago
parent
commit
c668ba2166

+ 4 - 1
src/main/frontend/handler/db_based/rtc_flows.cljs

@@ -10,7 +10,10 @@
   (:import [missionary Cancelled]))
 
 (def rtc-log-flow
-  (m/watch (:rtc/log @state/state)))
+  (->> (m/watch (:rtc/log @state/state))
+       (m/eduction
+        (remove #(and (= :skip (:sub-type %))
+                      (= :rtc.log/apply-remote-update (:type %)))))))
 
 (def rtc-download-log-flow
   (m/eduction

+ 2 - 4
src/main/frontend/worker/rtc/client.cljs

@@ -431,7 +431,7 @@
                                                         :graph-uuid graph-uuid :schema-version (str major-schema-version)
                                                         :ops [] :t-before (or local-tx 1)}))]
       (if-let [remote-ex (:ex-data r)]
-        (do (add-log-fn :rtc.log/push-local-update (assoc remote-ex :sub-type :pull-remote-data))
+        (do (add-log-fn :rtc.log/pull-remote-data (assoc remote-ex :sub-type :pull-remote-data-exception))
             (case (:type remote-ex)
               :graph-lock-failed nil
               :graph-lock-missing (throw r.ex/ex-remote-graph-lock-missing)
@@ -440,6 +440,4 @@
               (throw (ex-info "Unavailable3" {:remote-ex remote-ex}))))
         (do (assert (pos? (:t r)) r)
             (r.remote-update/apply-remote-update
-             graph-uuid repo conn date-formatter {:type :remote-update :value r} add-log-fn)
-            (add-log-fn :rtc.log/push-local-update {:sub-type :pull-remote-data
-                                                    :remote-t (:t r) :local-t local-tx}))))))
+             graph-uuid repo conn date-formatter {:type :remote-update :value r} add-log-fn))))))

+ 1 - 0
src/main/frontend/worker/rtc/log_and_state.cljs

@@ -24,6 +24,7 @@
        :rtc.log/download {:doc "rtc log type for upload-graph."}
        :rtc.log/cancelled {:doc "rtc has been cancelled"}
        :rtc.log/apply-remote-update {:doc "apply remote updates to local graph"}
+       :rtc.log/pull-remote-data {:doc "pull remote updates"}
        :rtc.log/push-local-update {:doc "push local updates to remote graph"}
        :rtc.log/higher-remote-schema-version-exists {:doc "remote-graph with larger schema-version exists"}
        :rtc.log/branch-graph {:doc "rtc log type for creating a new graph branch"}