mirror of
https://github.com/penpot/penpot.git
synced 2025-07-19 19:17:23 +02:00
✨ Improve internal state validation on db module
This commit is contained in:
parent
071ecca875
commit
1325e46192
5 changed files with 78 additions and 80 deletions
|
@ -50,14 +50,16 @@
|
|||
:cause cause))))
|
||||
instance-id)))
|
||||
|
||||
(s/def ::main/key ::us/string)
|
||||
(s/def ::main/props
|
||||
(s/map-of ::us/keyword some?))
|
||||
|
||||
(defmethod ig/pre-init-spec ::props [_]
|
||||
(s/keys :req-un [::db/pool]))
|
||||
(s/keys :req [::db/pool]
|
||||
:opt [::main/key]))
|
||||
|
||||
(defmethod ig/init-key ::props
|
||||
[_ {:keys [pool key] :as cfg}]
|
||||
[_ {:keys [::db/pool ::main/key] :as cfg}]
|
||||
(db/with-atomic [conn pool]
|
||||
(db/xact-lock! conn 0)
|
||||
(when-not key
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue