Makes new square loading much faster, parallel.
This commit is contained in:
@@ -42,7 +42,9 @@
|
||||
{:container (:DockerId container-data)
|
||||
:ip (-> container-data :Networks first :IPv4Addresses first)
|
||||
:env (:dd-env env)
|
||||
:service (:dd-service env)})))
|
||||
:service (or
|
||||
(System/getenv "INTEGREAT_JOB")
|
||||
(:dd-service env))})))
|
||||
|
||||
(defn stop-logging-context []
|
||||
(when (seq container-data)
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
(defn execute [name f]
|
||||
(try
|
||||
(lc/with-context {:background-job name}
|
||||
(mu/with-context {:background-job name}
|
||||
(mu/with-context {:background-job name
|
||||
:service name}
|
||||
(mount/start (mount/only #{#'conn #'metrics-setup #'container-tags #'logging-context #'container-data}))
|
||||
((heartbeat f name))
|
||||
(log/info "Stopping " name)
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
(:gen-class)
|
||||
(:require
|
||||
[auto-ap.jobs.core :refer [execute]]
|
||||
[auto-ap.square.core2 :as square2]))
|
||||
[auto-ap.square.core3 :as square3]))
|
||||
|
||||
(defn -main [& _]
|
||||
(execute "square2-loading" square2/upsert-all))
|
||||
(execute "square3-loading" square3/do-upsert-all))
|
||||
|
||||
|
||||
@@ -637,6 +637,7 @@
|
||||
|
||||
(defn upsert-all [ & clients]
|
||||
(capture-context->lc
|
||||
(log/info ::starting-upsert)
|
||||
(->> (apply get-square-clients clients)
|
||||
(s/->source)
|
||||
(s/filter (fn [client]
|
||||
@@ -687,9 +688,8 @@
|
||||
(s/reduce conj []))))
|
||||
|
||||
(defn do-upsert-all [& clients]
|
||||
(mu/with-context {:background-job "Square 3"}
|
||||
(mu/trace
|
||||
::upsert-all
|
||||
[:clients clients]
|
||||
@(apply upsert-all clients))))
|
||||
@(apply upsert-all clients)))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user