Allow only one wallet transactions sync loop
Signed-off-by: Dmitry Novotochinov <dmitry.novot@gmail.com>
This commit is contained in:
parent
0aaf20911a
commit
063ed16c47
|
@ -332,7 +332,7 @@
|
||||||
[:update-wallet]
|
[:update-wallet]
|
||||||
[:update-transactions]
|
[:update-transactions]
|
||||||
(when platform/mobile? [:get-fcm-token])
|
(when platform/mobile? [:get-fcm-token])
|
||||||
[:sync-wallet-transactions]
|
[:start-wallet-transactions-sync]
|
||||||
[:update-sign-in-time]]
|
[:update-sign-in-time]]
|
||||||
(seq events-after) (into events-after))}))
|
(seq events-after) (into events-after))}))
|
||||||
|
|
||||||
|
|
|
@ -477,6 +477,13 @@
|
||||||
(handlers/register-handler-fx
|
(handlers/register-handler-fx
|
||||||
:sync-wallet-transactions
|
:sync-wallet-transactions
|
||||||
(fn [cofx _]
|
(fn [cofx _]
|
||||||
(handlers-macro/merge-fx cofx
|
(wallet.transactions/sync cofx)))
|
||||||
(wallet.transactions/load-missing-chat-transactions)
|
|
||||||
(wallet.transactions/sync))))
|
(handlers/register-handler-fx
|
||||||
|
:start-wallet-transactions-sync
|
||||||
|
(fn [cofx _]
|
||||||
|
(when-not (get-in cofx [:db :wallet :transactions-sync-started?])
|
||||||
|
(handlers-macro/merge-fx cofx
|
||||||
|
(wallet.transactions/load-missing-chat-transactions)
|
||||||
|
(wallet.transactions/sync)
|
||||||
|
(wallet.transactions/set-sync-started)))))
|
||||||
|
|
|
@ -88,6 +88,9 @@
|
||||||
(< sync-interval-ms
|
(< sync-interval-ms
|
||||||
(- (time/timestamp) last-updated-at)))))
|
(- (time/timestamp) last-updated-at)))))
|
||||||
|
|
||||||
|
(defn set-sync-started [{:keys [db]}]
|
||||||
|
{:db (assoc-in db [:wallet :transactions-sync-started?] true)})
|
||||||
|
|
||||||
; Fetch updated data for any unconfirmed transactions or incoming chat transactions missing in wallet
|
; Fetch updated data for any unconfirmed transactions or incoming chat transactions missing in wallet
|
||||||
; and schedule new recurring sync request
|
; and schedule new recurring sync request
|
||||||
(defn sync [{:keys [db] :as cofx}]
|
(defn sync [{:keys [db] :as cofx}]
|
||||||
|
|
Loading…
Reference in New Issue