From 425a99575547b6549d04e0fbd7d49d837fee06e8 Mon Sep 17 00:00:00 2001 From: Bryce Date: Tue, 31 Oct 2023 08:35:33 -0700 Subject: [PATCH] improves performance of running balance cache --- src/clj/auto_ap/ledger.clj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/clj/auto_ap/ledger.clj b/src/clj/auto_ap/ledger.clj index f9ec95f3..363bcdbf 100644 --- a/src/clj/auto_ap/ledger.clj +++ b/src/clj/auto_ap/ledger.clj @@ -399,15 +399,15 @@ (defn accounts-needing-rebuild [ db client] (let [client (pull-id db client)] (->> (dc/qseq {:query '[:find ?c ?a ?l (min ?d) - :in $ ?c + :in $ $recent ?c :where - [?jel :journal-entry-line/dirty true] + [$recent ?jel :journal-entry-line/dirty true] [?jel :journal-entry-line/account ?a] [?jel :journal-entry-line/location ?l] [?je :journal-entry/line-items ?jel] [?je :journal-entry/client ?c] [?je :journal-entry/date ?d]] - :args [db client]}) + :args [db (dc/since db (c/to-date (t/plus (t/now) (t/hours -8)))) client]}) (map (fn [[client account location starting-at ]] {:client client :account account