🐛 Add a protection for some possible race condition

This commit is contained in:
Andrés Moya 2022-05-04 15:53:02 +02:00 committed by Alonso Torres
parent 1d39bbaa3c
commit 8fb22b8eee

View file

@ -569,6 +569,7 @@
ptk/WatchEvent
(watch [it state _]
(when (and (some? file-id) (some? library-id)) ; Prevent race conditions while navigating out of the file
(log/info :msg "SYNC-FILE"
:file (dwlh/pretty-file file-id state)
:library (dwlh/pretty-file library-id state))
@ -609,7 +610,7 @@
{:file-id file-id
:library-id library-id})))
(when (seq (:redo-changes library-changes))
(rx/of (sync-file-2nd-stage file-id library-id))))))))
(rx/of (sync-file-2nd-stage file-id library-id)))))))))
(defn sync-file-2nd-stage
"If some components have been modified, we need to launch another synchronization