🐛 Fix minor issue on internal srepl helpers

This commit is contained in:
Andrey Antukh 2024-03-22 12:59:16 +01:00
parent 7e803eeca8
commit a6c9ced5b3
2 changed files with 14 additions and 9 deletions

View file

@ -35,15 +35,18 @@
(defn get-file (defn get-file
"Get the migrated data of one file." "Get the migrated data of one file."
([id] (get-file (or *system* main/system) id)) ([id] (get-file (or *system* main/system) id nil))
([system id] ([system id & {:keys [raw?] :as opts}]
(db/run! system (db/run! system
(fn [system] (fn [system]
(binding [pmap/*load-fn* (partial feat.fdata/load-pointer system id)] (let [file (files/get-file system id :migrate? false)]
(-> (files/get-file system id :migrate? false) (if raw?
(update :data feat.fdata/process-pointers deref) file
(update :data feat.fdata/process-objects (partial into {})) (binding [pmap/*load-fn* (partial feat.fdata/load-pointer system id)]
(fmg/migrate-file))))))) (-> file
(update :data feat.fdata/process-pointers deref)
(update :data feat.fdata/process-objects (partial into {}))
(fmg/migrate-file)))))))))
(defn update-file! (defn update-file!
[system {:keys [id] :as file}] [system {:keys [id] :as file}]
@ -166,7 +169,7 @@
(fsnap/take-file-snapshot! system {:file-id file-id :label label})) (fsnap/take-file-snapshot! system {:file-id file-id :label label}))
(let [conn (db/get-connection system) (let [conn (db/get-connection system)
file (get-file system file-id) file (get-file system file-id opts)
libs (when with-libraries? libs (when with-libraries?
(->> (files/get-file-libraries conn file-id) (->> (files/get-file-libraries conn file-id)
(into [file] (map (fn [{:keys [id]}] (into [file] (map (fn [{:keys [id]}]

View file

@ -429,7 +429,9 @@
(try (try
(l/trc :hint "process:file:start" :file-id (str file-id) :index idx) (l/trc :hint "process:file:start" :file-id (str file-id) :index idx)
(let [system (assoc main/system ::db/rollback rollback?)] (let [system (assoc main/system ::db/rollback rollback?)]
(db/tx-run! system h/process-file! file-id update-fn opts)) (db/tx-run! system (fn [system]
(binding [h/*system* system]
(h/process-file! system file-id update-fn opts)))))
(catch Throwable cause (catch Throwable cause
(l/wrn :hint "unexpected error on processing file (skiping)" (l/wrn :hint "unexpected error on processing file (skiping)"