schedule :check-sync outside callback (which can be not called after locking/unlocking phone)
This commit is contained in:
parent
45a08d7643
commit
ec469f59b1
|
@ -74,18 +74,17 @@
|
|||
(when (and (not= sync-data state) (= :in-progress new-state))
|
||||
(dispatch [:set :sync-data state]))
|
||||
(when (not= sync-state new-state)
|
||||
(dispatch [:set :sync-state new-state]))
|
||||
(let [timeout (if (#{:done :synced} new-state) 60 10)]
|
||||
(s/execute-later #(dispatch [:check-sync]) (s/s->ms timeout)))))))
|
||||
(dispatch [:set :sync-state new-state]))))))
|
||||
|
||||
(register-handler :check-sync
|
||||
(u/side-effect!
|
||||
(fn [{:keys [web3] :as db}]
|
||||
(if web3
|
||||
(.getSyncing
|
||||
(.-eth web3)
|
||||
(fn [error sync]
|
||||
(dispatch [:update-sync-state error sync])))
|
||||
(do (.getSyncing
|
||||
(.-eth web3)
|
||||
(fn [error sync]
|
||||
(dispatch [:update-sync-state error sync])))
|
||||
(s/execute-later #(dispatch [:check-sync]) (s/s->ms 10)))
|
||||
(s/execute-later #(dispatch [:check-sync]) (s/s->ms 10))))))
|
||||
|
||||
(register-handler :initialize-sync-listener
|
||||
|
|
Loading…
Reference in New Issue