Makes refresh much faster
This commit is contained in:
@@ -528,16 +528,25 @@
|
||||
:client-index i
|
||||
:client-count (count clients)))))))
|
||||
|
||||
(defn clients-needing-refresh []
|
||||
(map first
|
||||
(dc/q '[:find (pull ?c [:client/code :db/id])
|
||||
:in $ $recent
|
||||
:where [$recent ?jel :journal-entry-line/dirty true]
|
||||
[$ ?je :journal-entry/line-items ?jel]
|
||||
[$ ?je :journal-entry/client ?c]]
|
||||
(dc/db conn)
|
||||
(dc/since
|
||||
(dc/db conn)
|
||||
(c/to-date (t/plus (t/now) (t/hours -4)))))))
|
||||
|
||||
(defn refresh-running-balance-cache
|
||||
([] (refresh-running-balance-cache (shuffle (map first
|
||||
(dc/q '[:find (pull ?c [:client/code :db/id])
|
||||
:where [?c :client/code]]
|
||||
(dc/db conn))))))
|
||||
([] (refresh-running-balance-cache (shuffle (clients-needing-refresh))))
|
||||
([clients]
|
||||
(doseq [[c i] (map vector clients (range))]
|
||||
(mu/trace ::building-running-balance
|
||||
[:client c]
|
||||
(mu/with-context {:client c
|
||||
(mu/with-context {:client c
|
||||
:client-index i
|
||||
:client-count (count clients)}
|
||||
(mu/log ::searching-for-accounts)
|
||||
|
||||
Reference in New Issue
Block a user