Updates for events.

This commit is contained in:
2022-01-06 07:24:05 -08:00
parent 1439f291b4
commit 6cb8731b7f
6 changed files with 111 additions and 53 deletions

View File

@@ -1,16 +1,22 @@
(ns auto-ap.import.yodlee2
(:require [auto-ap.datomic :refer [conn]]
[auto-ap.import.transactions :as t]
[auto-ap.import.yodlee :as y]
[auto-ap.utils :refer [allow-once]]
[auto-ap.yodlee.core2 :as client2]
[datomic.api :as d]
[mount.core :as mount]
[unilog.context :as lc]
[yang.scheduler :as scheduler]))
(:require
[auto-ap.datomic :refer [conn]]
[auto-ap.import.transactions :as t]
[auto-ap.import.yodlee :as y]
[auto-ap.utils :refer [allow-once]]
[auto-ap.yodlee.core2 :as client2]
[com.unbounce.dogstatsd.core :as statsd]
[datomic.api :as d]
[mount.core :as mount]
[unilog.context :as lc]
[yang.scheduler :as scheduler]))
(defn import-yodlee2 []
(lc/with-context {:source "Import yodlee2 transactions"}
(statsd/event {:title "Yodlee2 import started"
:text "Starting"
:priority :low}
nil)
(let [import-batch (t/start-import-batch :import-source/yodlee2 "Automated yodlee2 user")]
(try
(let [account-lookup (d/q '[:find ?ya ?ba ?cd
@@ -28,8 +34,18 @@
:transaction/client [:client/code client-code])))
(t/finish! import-batch))
(statsd/event {:title "Yodlee2 import Finished"
:text (pr-str (t/get-stats import-batch))
:priority :low}
nil)
(catch Exception e
(t/fail! import-batch e))))))
(t/fail! import-batch e)
(statsd/event {:title "Yodlee2 import failed"
:text (str e)
:alert-type :warning
:priority :normal}
nil))))))