Add db conn dynamic binding for srepl helpers

This commit is contained in:
Andrey Antukh 2025-04-29 14:23:28 +02:00
parent 7cb2f307d8
commit 2aa2525d0e
2 changed files with 6 additions and 2 deletions

View file

@ -42,6 +42,8 @@
org.postgresql.util.PGInterval
org.postgresql.util.PGobject))
(def ^:dynamic *conn* nil)
(declare open)
(declare create-pool)

View file

@ -423,7 +423,8 @@
(let [file-id (h/parse-uuid file-id)]
(db/tx-run! (assoc main/system ::db/rollback rollback?)
(fn [system]
(binding [h/*system* system]
(binding [h/*system* system
db/*conn* (db/get-connection system)]
(h/process-file! system file-id update-fn opts))))))
(defn process-team-files!
@ -436,7 +437,8 @@
(when (string? label)
(h/take-team-snapshot! system team-id label))
(binding [h/*system* system]
(binding [h/*system* system
db/*conn* (db/get-connection system)]
(->> (feat.comp-v2/get-and-lock-team-files conn team-id)
(reduce (fn [result file-id]
(if (h/process-file! system file-id update-fn opts)