Procházet zdrojové kódy

reset *sync-entered when sync stopped

Tienson Qin před 3 roky
rodič
revize
4065ed353e

+ 1 - 3
src/main/frontend/components/file_sync.cljs

@@ -376,9 +376,7 @@
                                                 (second @graphs-txid)
                                                 (fs-sync/graph-sync-off? (second @graphs-txid))
                                                 (async/<! (fs-sync/<check-remote-graph-exists (second @graphs-txid))))
-                                           (do
-                                             (prn "sync start")
-                                             (fs-sync/sync-start))
+                                           (fs-sync/sync-start)
 
                                            ;; remote graph already has been deleted, clear repos first, then create-remote-graph
                                            synced-file-graph?  ; <check-remote-graph-exists -> false

+ 5 - 2
src/main/frontend/fs/sync.cljs

@@ -2929,6 +2929,9 @@
     (reset! current-sm-graph-uuid graph-uuid)
     (sync-manager user-uuid graph-uuid base-path repo txid *sync-state)))
 
+;; Avoid sync reentrancy
+(defonce *sync-entered? (atom false))
+
 (defn <sync-stop []
   (go
     (when-let [sm ^SyncManager (state/get-file-sync-manager (state/get-current-file-sync-graph-uuid))]
@@ -2938,6 +2941,8 @@
 
       (<! (-stop! sm))
 
+      (reset! *sync-entered? false)
+
       (println "[SyncManager" (:graph-uuid sm) "]" "stopped"))
 
     (reset! current-sm-graph-uuid nil)))
@@ -2996,8 +3001,6 @@
 
 (declare network-online-cursor)
 
-;; Avoid reentrancy
-(defonce *sync-entered? (atom false))
 (defn sync-start
   []
   (when (false? @*sync-entered?)