Should give a bit more clarity if refunds don't load

This commit is contained in:
2023-03-03 10:03:16 -08:00
parent eb87367e8b
commit 0ff147a7a0

View File

@@ -589,19 +589,27 @@
([client]
(apply de/zip
(for [square-location (:client/square-locations client)
:when (:square-location/client-location square-location)]
:when (:square-location/client-location square-location)]
(upsert-refunds client square-location))))
([client location]
(de/chain (refunds client location)
(fn [refunds]
(mu/with-context {:source "Loading Square Settlements"
:client (:client/code client)
:location (:square-location/client-location client)}
(doseq [x (partition-all 100 refunds)]
(log/info ::loading-refunds
:count (count x))
@(d/transact conn x))
(log/info ::done-loading-refunds))))))
(with-context-as {:source "Square refunds loading"
:client (:client/code client)} lc
(de/chain (refunds client location)
(fn [refunds]
(mu/with-context lc
(try
(doseq [x (partition-all 100 refunds)]
(log/info ::loading-refunds
:count (count x)
:sample (first x))
@(d/transact conn x))
(catch Throwable e
(log/error ::upsert-refunds-failed
:exception e)))
(log/info ::done-loading-refunds)))))))
(def square-read [:db/id
:client/code