starts logging in the event of an issue.

This commit is contained in:
2023-03-30 11:11:17 -07:00
parent 744c4b60f7
commit c8ada656c8
3 changed files with 28 additions and 38 deletions

View File

@@ -3,6 +3,7 @@
[auto-ap.datomic
:refer [audit-transact
audit-transact-batch
transact-with-backoff
conn
pull-id
pull-ref
@@ -504,18 +505,6 @@
(:bank-account/numeric-code (bank-accounts a)))
:client_id client-id})))
(defn upsert-batch-impl
([batch ] (upsert-batch-impl batch 0))
([batch attempt]
(try
(dc/transact auto-ap.datomic/conn {:tx-data batch})
batch
(catch Exception e
(if (< attempt 10)
(do
(Thread/sleep (* attempt 1000))
(upsert-batch-impl batch (inc attempt)))
(throw e))))))
(defn reset-client+account+location+date
([] (reset-client+account+location+date (map first (dc/q '[:find ?c :where [?c :client/code]] (dc/db conn)))))
@@ -549,7 +538,7 @@
(s/->source)
(s/map (fn [batch]
(de/future
(upsert-batch-impl batch)
(transact-with-backoff batch)
(count batch))))
(s/buffer 50)
(s/realize-each)
@@ -711,7 +700,7 @@
(s/transform (partition-all 500))
(s/map (fn [batch]
(de/future
(upsert-batch-impl batch)
(transact-with-backoff batch)
(count batch))))
(s/buffer 50)
(s/realize-each)