More background task cleanup

This commit is contained in:
2022-09-23 12:09:39 -07:00
parent e201a8b03e
commit ed759bac31
19 changed files with 102 additions and 179 deletions

View File

@@ -2,17 +2,18 @@
(:gen-class)
(: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.close-auto-invoices :as job-close-auto-invoices]
[auto-ap.jobs.current-balance-cache :as job-current-balance-cache]
[auto-ap.jobs.import-uploaded-invoices :as job-import-uploaded-invoices]
[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.sysco :as job-sysco]
[auto-ap.jobs.vendor-usages :as job-vendor-usages]
[auto-ap.jobs.yodlee2 :as job-yodlee2]
[auto-ap.ledger :as ledger]
[clojure.tools.logging :as log]
@@ -79,9 +80,6 @@
:start (scheduler/every (* 1000 10) collect-jetty-stats)
:stop (scheduler/stop jetty-stats))
(defn shutdown-mount []
(mount/stop))
@@ -106,24 +104,24 @@
(= job "intuit")
(job-intuit/-main)
(= job "hello-world")
(do
(log/info "HELLO WORLD")
(Thread/sleep 10000)
(log/info "GOODBYE WORLD")
(Thread/sleep 10000)
(System/exit 0))
(= job "vendor-usages")
(job-vendor-usages/-main)
(= job "import-uploaded-invoices")
(job-import-uploaded-invoices/-main)
(= job "sysco")
(job-sysco/-main)
(= job "close-auto-invoices")
(job-close-auto-invoices/-main)
:else
(let [without (cond-> []
(not (env :run-web? )) (into [#'jetty
#'jetty-stats])
(not (env :run-background?)) (into [#'vendor/refresh-vendor-usages-worker
#'mail/import-invoices
#'ledger/process-txes-worker
(not (env :run-background?)) (into [#'ledger/process-txes-worker
#'requests/request-listener
#'sysco/sysco-invoice-importer
#'auto-ap.background.invoices/close-auto-invoices-worker
#'migrate/migrate-start]))]
(log/info "starting without " without)