Pulling out other imports
This commit is contained in:
@@ -84,11 +84,3 @@
|
||||
{:intuit-bank-account/external-id (:name ba)
|
||||
:intuit-bank-account/name (:name ba)})
|
||||
bank-accounts))))
|
||||
|
||||
(mount/defstate import-worker
|
||||
:start (scheduler/every (* 1000 60 60 24) (heartbeat import-intuit "import-intuit"))
|
||||
:stop (scheduler/stop import-worker))
|
||||
|
||||
(mount/defstate account-worker
|
||||
:start (scheduler/every (* 1000 60 30) upsert-accounts)
|
||||
:stop (scheduler/stop account-worker))
|
||||
|
||||
@@ -61,9 +61,3 @@
|
||||
|
||||
(def import-plaid (allow-once import-plaid-int))
|
||||
|
||||
(mount/defstate import-worker
|
||||
:start (scheduler/every (* 1000 60 60 3) (heartbeat import-plaid "import-plaid"))
|
||||
:stop (scheduler/stop import-worker))
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -88,11 +88,3 @@
|
||||
|
||||
(def import-yodlee2 (allow-once import-yodlee2-int))
|
||||
|
||||
|
||||
(mount/defstate import-worker
|
||||
:start (scheduler/every (* 1000 60 60 4) (heartbeat import-yodlee2 "import-yodlee"))
|
||||
:stop (scheduler/stop import-worker))
|
||||
|
||||
(mount/defstate account-worker
|
||||
:start (scheduler/every (* 5 60 1000) (heartbeat client2/upsert-accounts "upsert-yodlee2-accounts"))
|
||||
:stop (scheduler/stop account-worker))
|
||||
|
||||
21
src/clj/auto_ap/jobs/intuit.clj
Normal file
21
src/clj/auto_ap/jobs/intuit.clj
Normal file
@@ -0,0 +1,21 @@
|
||||
(ns auto-ap.jobs.intuit
|
||||
(:gen-class)
|
||||
(:require [auto-ap.utils :refer [heartbeat]]
|
||||
[mount.core :as mount]
|
||||
[auto-ap.datomic :refer [conn]]
|
||||
[clojure.tools.logging :as log]
|
||||
[auto-ap.background.metrics :refer [metrics-setup container-tags container-data logging-context]]
|
||||
[unilog.context :as lc]
|
||||
[auto-ap.import.intuit :as intuit]))
|
||||
|
||||
(defn -main [& _]
|
||||
(try
|
||||
(lc/with-context {:background-job "import-intuit"}
|
||||
(mount/start (mount/only #{#'conn #'metrics-setup #'container-tags #'logging-context #'container-data}))
|
||||
((heartbeat intuit/upsert-accounts "import-intuit-accounts"))
|
||||
((heartbeat intuit/import-intuit "import-intuit"))
|
||||
(mount/stop)
|
||||
(log/info "Stopping intuit import")
|
||||
(Thread/sleep 15000))
|
||||
(finally
|
||||
(System/exit 0))))
|
||||
20
src/clj/auto_ap/jobs/plaid.clj
Normal file
20
src/clj/auto_ap/jobs/plaid.clj
Normal file
@@ -0,0 +1,20 @@
|
||||
(ns auto-ap.jobs.plaid
|
||||
(:gen-class)
|
||||
(:require [auto-ap.utils :refer [heartbeat]]
|
||||
[mount.core :as mount]
|
||||
[auto-ap.datomic :refer [conn]]
|
||||
[clojure.tools.logging :as log]
|
||||
[auto-ap.background.metrics :refer [metrics-setup container-tags container-data logging-context]]
|
||||
[unilog.context :as lc]
|
||||
[auto-ap.import.plaid :as plaid]))
|
||||
|
||||
(defn -main [& _]
|
||||
(try
|
||||
(lc/with-context {:background-job "import-plaid"}
|
||||
(mount/start (mount/only #{#'conn #'metrics-setup #'container-tags #'logging-context #'container-data}))
|
||||
((heartbeat plaid/import-plaid "import-plaid"))
|
||||
(mount/stop)
|
||||
(log/info "Stopping plaid import")
|
||||
(Thread/sleep 15000))
|
||||
(finally
|
||||
(System/exit 0))))
|
||||
23
src/clj/auto_ap/jobs/yodlee2.clj
Normal file
23
src/clj/auto_ap/jobs/yodlee2.clj
Normal file
@@ -0,0 +1,23 @@
|
||||
(ns auto-ap.jobs.yodlee2
|
||||
(:gen-class)
|
||||
(:require [auto-ap.utils :refer [heartbeat]]
|
||||
[mount.core :as mount]
|
||||
[auto-ap.datomic :refer [conn]]
|
||||
[auto-ap.yodlee.core2 :as client2]
|
||||
[clojure.tools.logging :as log]
|
||||
[auto-ap.background.metrics :refer [metrics-setup container-tags container-data logging-context]]
|
||||
[unilog.context :as lc]
|
||||
[auto-ap.import.yodlee2 :as yodlee2]))
|
||||
|
||||
(defn -main [& _]
|
||||
(try
|
||||
(lc/with-context {:background-job "import-yodlee"}
|
||||
(mount/start (mount/only #{#'conn #'metrics-setup #'container-tags #'logging-context #'container-data}))
|
||||
((heartbeat client2/upsert-accounts "upsert-yodlee2-accounts"))
|
||||
((heartbeat yodlee2/import-yodlee2 "import-yodlee"))
|
||||
(mount/stop)
|
||||
(log/info "Stopping yodlee import")
|
||||
(Thread/sleep 15000))
|
||||
(finally
|
||||
(System/exit 0))))
|
||||
|
||||
@@ -1,32 +1,30 @@
|
||||
(ns auto-ap.server
|
||||
(:gen-class)
|
||||
#_{:clj-kondo/ignore [:unused-namespace]}
|
||||
(:require auto-ap.background.invoices
|
||||
[auto-ap.background.requests :as requests]
|
||||
[auto-ap.background.sysco :as sysco]
|
||||
[auto-ap.background.vendor :as vendor]
|
||||
[auto-ap.datomic.migrate :as migrate]
|
||||
[auto-ap.graphql.clients :as gq-clients]
|
||||
[auto-ap.handler :refer [app]]
|
||||
[auto-ap.import.intuit :as intuit]
|
||||
[auto-ap.import.plaid :as plaid]
|
||||
[auto-ap.import.yodlee2 :as yodlee2]
|
||||
[auto-ap.ledger :as ledger]
|
||||
[auto-ap.square.core :as square]
|
||||
[auto-ap.background.metrics :as metrics]
|
||||
[auto-ap.background.mail :as mail]
|
||||
[auto-ap.jobs.square :as job-square]
|
||||
[auto-ap.jobs.ledger-reconcile :as job-reconcile-ledger]
|
||||
[auto-ap.jobs.current-balance-cache :as job-current-balance-cache]
|
||||
[clojure.tools.logging :as log]
|
||||
[config.core :refer [env]]
|
||||
[mount.core :as mount]
|
||||
[nrepl.server :refer [start-server]]
|
||||
[ring.adapter.jetty :refer [run-jetty]]
|
||||
[yang.scheduler :as scheduler]
|
||||
[com.unbounce.dogstatsd.core :as statsd])
|
||||
(:import [org.eclipse.jetty.server.handler.gzip GzipHandler]
|
||||
[org.eclipse.jetty.server.handler StatisticsHandler]))
|
||||
(:require
|
||||
[auto-ap.background.invoices]
|
||||
[auto-ap.background.mail :as mail]
|
||||
[auto-ap.background.requests :as requests]
|
||||
[auto-ap.background.sysco :as sysco]
|
||||
[auto-ap.background.vendor :as vendor]
|
||||
[auto-ap.datomic.migrate :as migrate]
|
||||
[auto-ap.handler :refer [app]]
|
||||
[auto-ap.jobs.current-balance-cache :as job-current-balance-cache]
|
||||
[auto-ap.jobs.intuit :as job-intuit]
|
||||
[auto-ap.jobs.ledger-reconcile :as job-reconcile-ledger]
|
||||
[auto-ap.jobs.plaid :as job-plaid]
|
||||
[auto-ap.jobs.square :as job-square]
|
||||
[auto-ap.jobs.yodlee2 :as job-yodlee2]
|
||||
[auto-ap.ledger :as ledger]
|
||||
[clojure.tools.logging :as log]
|
||||
[com.unbounce.dogstatsd.core :as statsd]
|
||||
[config.core :refer [env]]
|
||||
[mount.core :as mount]
|
||||
[nrepl.server :refer [start-server]]
|
||||
[ring.adapter.jetty :refer [run-jetty]]
|
||||
[yang.scheduler :as scheduler])
|
||||
(:import
|
||||
(org.eclipse.jetty.server.handler StatisticsHandler)
|
||||
(org.eclipse.jetty.server.handler.gzip GzipHandler)))
|
||||
|
||||
(defn add-shutdown-hook! [^Runnable f]
|
||||
(.addShutdownHook (Runtime/getRuntime)
|
||||
@@ -99,6 +97,15 @@
|
||||
(= job "current-balance-cache")
|
||||
(job-current-balance-cache/-main)
|
||||
|
||||
(= job "yodlee2")
|
||||
(job-yodlee2/-main)
|
||||
|
||||
(= job "plaid")
|
||||
(job-plaid/-main)
|
||||
|
||||
(= job "intuit")
|
||||
(job-intuit/-main)
|
||||
|
||||
(= job "hello-world")
|
||||
(do
|
||||
(log/info "HELLO WORLD")
|
||||
@@ -117,11 +124,6 @@
|
||||
#'requests/request-listener
|
||||
#'sysco/sysco-invoice-importer
|
||||
#'auto-ap.background.invoices/close-auto-invoices-worker
|
||||
#'yodlee2/import-worker
|
||||
#'yodlee2/account-worker
|
||||
#'intuit/import-worker
|
||||
#'intuit/account-worker
|
||||
#'plaid/import-worker
|
||||
#'migrate/migrate-start]))]
|
||||
(log/info "starting without " without)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user