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