enhance(debug): capture sync replay diagnostics

This commit is contained in:
Tienson Qin
2026-04-09 22:46:43 +08:00
parent abd3e4c16b
commit 6cd3708c22
3 changed files with 385 additions and 21 deletions

View File

@@ -548,6 +548,18 @@
[repo]
(db-sync/upload-graph! repo))
(def-thread-api :thread-api/db-sync-stop-upload
[repo]
(db-sync/stop-upload! repo))
(def-thread-api :thread-api/db-sync-resume-upload
[repo]
(db-sync/resume-upload! repo))
(def-thread-api :thread-api/db-sync-upload-stopped?
[repo]
(db-sync/upload-stopped? repo))
(def-thread-api :thread-api/db-sync-download-graph
[repo graph-id graph-e2ee?]
(sync-download/download-graph-by-id! repo graph-id graph-e2ee?))

View File

@@ -8,3 +8,26 @@
(get @state/state (keyword path))
@state/state)
(bean/->js)))
(defn- current-repo-or-throw
[]
(if-let [repo (state/get-current-repo)]
repo
(throw (ex-info "No current repo" {:type :debug/no-current-repo}))))
(defn ^:export syncStopUpload
[]
(state/<invoke-db-worker :thread-api/db-sync-stop-upload (current-repo-or-throw)))
(defn ^:export syncResumeUpload
[]
(state/<invoke-db-worker :thread-api/db-sync-resume-upload (current-repo-or-throw)))
(defn ^:export syncUploadStopped
[]
(state/<invoke-db-worker :thread-api/db-sync-upload-stopped? (current-repo-or-throw)))
;; Snake_case aliases for consistency with existing debug exports.
(defn ^:export sync_stop_upload [] (syncStopUpload))
(defn ^:export sync_resume_upload [] (syncResumeUpload))
(defn ^:export sync_upload_stopped [] (syncUploadStopped))