Merge branch 'staging' into add-scheduled-payment-filter

This commit is contained in:
Bryce Covert
2021-01-06 08:17:20 -08:00
4 changed files with 21 additions and 17 deletions

View File

@@ -444,12 +444,14 @@
(into #{} (map :db/id (d-clients/get-all))))
starting (java.util.Date.)]
(log/info (count clients-needing-refresh) "Clients need their balance cache refreshed.")
(reduce
(fn [acc client]
(log/info "Computing running balance cache for " (:client/code (d/entity (d/db conn) client)))
(assoc acc client (running-balance-for client)))
{}
clients-needing-refresh)
(swap! running-balance-cache
merge
(reduce
(fn [acc client]
(log/info "Computing running balance cache for " (:client/code (d/entity (d/db conn) client)))
(assoc acc client (running-balance-for client)))
{}
clients-needing-refresh))
(log/info "Done refreshing " (count clients-needing-refresh) " client caches")
(reset! last-run-running-balance starting)))
@@ -459,7 +461,7 @@
(lc/with-context {:source "running-balance-cache"}
(try
(log/info "Refreshing running balance cache")
(reset! running-balance-cache (build-running-balance-cache))
(build-running-balance-cache)
(catch Exception e
(log/error e)))))