[#9987] Stop fetching new blocks while app is not active
This commit is contained in:
parent
c2e195979c
commit
cc520a1f27
|
@ -210,23 +210,26 @@
|
|||
|
||||
(fx/defn new-transfers
|
||||
{:events [::new-transfers]}
|
||||
[{:keys [db] :as cofx} transfers {:keys [address historical? limit]}]
|
||||
[{:keys [db] :as cofx} transfers {:keys [address limit]}]
|
||||
(log/debug "[transfers] new-transfers"
|
||||
"address" address
|
||||
"count" (count transfers)
|
||||
"limit" limit)
|
||||
(let [checksum (eip55/address->checksum address)
|
||||
min-known-block (or (get-min-known-block db address)
|
||||
(:ethereum/current-block db))
|
||||
effects (cond-> [(when (seq transfers)
|
||||
(set-lowest-fetched-block checksum transfers))]
|
||||
|
||||
(seq transfers)
|
||||
(concat (mapv add-transfer transfers))
|
||||
;;NOTE: we only update the balance for new transfers and not
|
||||
;; historical ones
|
||||
(not historical?)
|
||||
|
||||
true
|
||||
(conj (wallet/update-balances
|
||||
(into [] (reduce (fn [acc {:keys [address]}]
|
||||
(conj acc address))
|
||||
(into [] (reduce (fn [acc {:keys [address block]}]
|
||||
(if (> block min-known-block)
|
||||
(conj acc address)
|
||||
acc))
|
||||
#{}
|
||||
transfers))))
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"_comment": "DO NOT EDIT THIS FILE BY HAND. USE 'scripts/update-status-go.sh <tag>' instead",
|
||||
"owner": "status-im",
|
||||
"repo": "status-go",
|
||||
"version": "v0.48.3",
|
||||
"commit-sha1": "7be1fcb978ad3a640b9eb6372eea4caf4e1bfb03",
|
||||
"src-sha256": "100dls7fcddcfziw1rhdb2aaj0lpwi2ri6bnr503sxbjaac1zmnb"
|
||||
"version": "v0.48.8",
|
||||
"commit-sha1": "d1beb4c76d9fabcd00da75ad63430104f92c1404",
|
||||
"src-sha256": "0sx85hg5c1dap2cnf44kqgp0lbknl4wd3n47cchiivnlmv4c9gw8"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue