fix(sync): validate rsapi upload err

when localtime incorrect, aws s3 return "Request is not yet valid" err
pull/9353/head
rcmerci 2023-05-12 11:30:54 +08:00 committed by Andelf
parent 8d46b5cb23
commit adef15d073
2 changed files with 14 additions and 2 deletions

View File

@ -371,6 +371,8 @@
:file-sync/other-user-graph "Current local graph is bound to other user's remote graph. So can't start syncing."
:file-sync/graph-deleted "The current remote graph has been deleted"
:file-sync/rsapi-cannot-upload-err "Unable to start synchronization, please check if the local time is correct."
:notification/clear-all "Clear all"}
@ -763,7 +765,7 @@
:right-side-bar/history "(Dev) Verlauf rückgängig machen / wiederherstellen"
:select/default-select-multiple "Ein oder mehrere auswählen"
:settings-page/auto-expand-block-refs "Automatisch beim Heranzoomen Blockreferenzen erweitern..."
:whiteboard/link-whiteboard-or-block "Whiteboard/Seite/Block verknüpfen"}
:nl {
:all-files "Alle bestanden"
@ -1683,6 +1685,7 @@
:file-sync/other-user-graph "当前本地图谱绑定在其他用户的远程图谱上。因此无法启动同步。"
:file-sync/graph-deleted "当前远程图谱已经删除"
:file-sync/rsapi-cannot-upload-err "无法同步,请检查本机时间是否准确"
:notification/clear-all "清除全部通知"}

View File

@ -1680,6 +1680,10 @@
[r]
(some->> (ex-cause r) str (re-find #"graph-not-exist")))
(defn- stop-sync-by-rsapi-response?
[r]
(some->> (ex-cause r) str (re-find #"Request is not yet valid")))
;; type = "change" | "add" | "unlink"
(deftype FileChangeEvent [type dir path stat checksum]
@ -2594,10 +2598,15 @@
(do (println :graph-has-been-deleted r*)
{:graph-has-been-deleted true})
(stop-sync-by-rsapi-response? r*)
(do (println :stop-sync-caused-by-rsapi-err-response r*)
(notification/show! (t :file-sync/rsapi-cannot-upload-err) :warning false)
{:stop true})
paused?
{:pause true}
succ? ; succ
succ? ; succ
(do
(println "sync-local->remote! update txid" r*)
;; persist txid