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/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/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"} :notification/clear-all "Clear all"}
@ -1683,6 +1685,7 @@
:file-sync/other-user-graph "当前本地图谱绑定在其他用户的远程图谱上。因此无法启动同步。" :file-sync/other-user-graph "当前本地图谱绑定在其他用户的远程图谱上。因此无法启动同步。"
:file-sync/graph-deleted "当前远程图谱已经删除" :file-sync/graph-deleted "当前远程图谱已经删除"
:file-sync/rsapi-cannot-upload-err "无法同步,请检查本机时间是否准确"
:notification/clear-all "清除全部通知"} :notification/clear-all "清除全部通知"}

View File

@ -1680,6 +1680,10 @@
[r] [r]
(some->> (ex-cause r) str (re-find #"graph-not-exist"))) (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" ;; type = "change" | "add" | "unlink"
(deftype FileChangeEvent [type dir path stat checksum] (deftype FileChangeEvent [type dir path stat checksum]
@ -2594,6 +2598,11 @@
(do (println :graph-has-been-deleted r*) (do (println :graph-has-been-deleted r*)
{:graph-has-been-deleted true}) {: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? paused?
{:pause true} {:pause true}