mirror of
https://github.com/penpot/penpot.git
synced 2025-06-06 12:42:13 +02:00
✨ Ensure connection on persisting pointers
This commit is contained in:
parent
ba55d657a4
commit
8981e57deb
1 changed files with 9 additions and 8 deletions
|
@ -81,14 +81,15 @@
|
||||||
"Given a database connection and the final file-id, persist all
|
"Given a database connection and the final file-id, persist all
|
||||||
pointers to the underlying storage (the database)."
|
pointers to the underlying storage (the database)."
|
||||||
[system file-id]
|
[system file-id]
|
||||||
(doseq [[id item] @pmap/*tracked*]
|
(let [conn (db/get-connection system)]
|
||||||
(when (pmap/modified? item)
|
(doseq [[id item] @pmap/*tracked*]
|
||||||
(l/trc :hint "persist pointer" :file-id (str file-id) :id (str id))
|
(when (pmap/modified? item)
|
||||||
(let [content (-> item deref blob/encode)]
|
(l/trc :hint "persist pointer" :file-id (str file-id) :id (str id))
|
||||||
(db/insert! system :file-data-fragment
|
(let [content (-> item deref blob/encode)]
|
||||||
{:id id
|
(db/insert! conn :file-data-fragment
|
||||||
:file-id file-id
|
{:id id
|
||||||
:content content})))))
|
:file-id file-id
|
||||||
|
:content content}))))))
|
||||||
|
|
||||||
(defn process-pointers
|
(defn process-pointers
|
||||||
"Apply a function to all pointers on the file. Usuly used for
|
"Apply a function to all pointers on the file. Usuly used for
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue