Skip to content

Commit

Permalink
fix: remove tricky check
Browse files Browse the repository at this point in the history
  • Loading branch information
tiensonqin committed Sep 5, 2022
1 parent ce0a2e5 commit 1f72691
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/main/frontend/fs/sync.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -1544,14 +1544,15 @@
[type {:keys [dir path _content stat] :as _payload}]
(when-let [current-graph (state/get-current-repo)]
(when (string/ends-with? current-graph dir)
(when-not (sync-state--stopped? (state/get-file-sync-state current-graph))
(when (or (:mtime stat) (= type "unlink"))
(go
(let [path (remove-dir-prefix dir path)
files-meta (and (not= "unlink" type)
(<! (<get-local-files-meta rsapi "" dir [path])))
checksum (and (coll? files-meta) (some-> files-meta first :etag))]
(>! local-changes-chan (->FileChangeEvent type dir path stat checksum)))))))))
(let [sync-state (state/get-file-sync-state current-graph)]
(when (and sync-state (not (sync-state--stopped? sync-state)))
(when (or (:mtime stat) (= type "unlink"))
(go
(let [path (remove-dir-prefix dir path)
files-meta (and (not= "unlink" type)
(<! (<get-local-files-meta rsapi "" dir [path])))
checksum (and (coll? files-meta) (some-> files-meta first :etag))]
(>! local-changes-chan (->FileChangeEvent type dir path stat checksum))))))))))

(defn local-changes-revised-chan-builder
"return chan"
Expand Down Expand Up @@ -1975,9 +1976,9 @@
add-history? (update :history add-history-items paths now))))

(defn sync-state--stopped?
"Graph syncing is stopped or not enabled"
"Graph syncing is stopped"
[sync-state]
(or (nil? sync-state) (= ::stop (:state sync-state))))
(= ::stop (:state sync-state)))

;;; ### remote->local syncer & local->remote syncer

Expand Down

0 comments on commit 1f72691

Please sign in to comment.