More background task cleanup
This commit is contained in:
@@ -1,23 +1,11 @@
|
||||
(ns auto-ap.jobs.current-balance-cache
|
||||
(:gen-class)
|
||||
(:require [auto-ap.graphql.clients :as clients]
|
||||
[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]))
|
||||
(:require
|
||||
[auto-ap.graphql.clients :as clients]
|
||||
[auto-ap.jobs.core :refer [execute]]))
|
||||
|
||||
(defn -main [& _]
|
||||
(try
|
||||
(lc/with-context {:background-job "current-balance-cache"}
|
||||
(mount/start (mount/only #{#'conn #'metrics-setup #'container-tags #'logging-context #'container-data}))
|
||||
((heartbeat clients/refresh-current-balance "current-balance-cache"))
|
||||
(mount/stop )
|
||||
(log/info "Stopping current-balance-cache")
|
||||
(Thread/sleep 15000)
|
||||
(System/exit 0))
|
||||
(finally
|
||||
(System/exit 0))))
|
||||
(execute "current-balance-cache" clients/refresh-current-balance))
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user