more detection of problems.
This commit is contained in:
@@ -249,13 +249,17 @@
|
||||
(catch Exception e
|
||||
(log/warn "error pulling http " e)
|
||||
(retry f (inc i))))
|
||||
(log/error "Too many failures"))))
|
||||
(log/warn "Too many failures"))))
|
||||
|
||||
(defn get-payment [client p]
|
||||
(:payment (:body (retry #(client/get (str "https://connect.squareup.com/v2/payments/" p)
|
||||
{:headers (client-base-headers client)
|
||||
:as :json
|
||||
:retry-handler retry-4})))))
|
||||
(defn halt-if-error [x]
|
||||
(if (instance? Throwable x)
|
||||
(throw x)
|
||||
x))
|
||||
|
||||
(defn get-settlement-sales-date [client settlement]
|
||||
(let [concurrent 10
|
||||
@@ -281,8 +285,10 @@
|
||||
true
|
||||
(fn [e]
|
||||
(lc/with-context {:source "Square settlements loading "}
|
||||
(log/error "Error loading sales date details" e))))
|
||||
(log/warn "Error loading sales date details" e)
|
||||
e)))
|
||||
(->> (async/<!! (async/into [] output-chan))
|
||||
(map halt-if-error)
|
||||
sort
|
||||
(drop 2)
|
||||
first)))
|
||||
@@ -308,8 +314,10 @@
|
||||
true
|
||||
(fn [e]
|
||||
(lc/with-context {:source "Square settlements loading "}
|
||||
(log/error "Error loading settlements details" e))))
|
||||
(async/<!! (async/into [] output-chan))))
|
||||
(log/warn "Error loading settlements details" e)
|
||||
e)))
|
||||
(->> (async/<!! (async/into [] output-chan))
|
||||
(map halt-if-error))))
|
||||
|
||||
(defn settlements
|
||||
([client location] (settlements client location (lookup-dates)))
|
||||
|
||||
Reference in New Issue
Block a user