mirror of
https://github.com/penpot/penpot.git
synced 2025-05-12 01:46:37 +02:00
Merge remote-tracking branch 'origin/staging' into develop
This commit is contained in:
commit
496afb0f25
11 changed files with 40 additions and 63 deletions
|
@ -81,7 +81,7 @@
|
|||
(let [explain (ex/explain data)]
|
||||
{::yrs/status 400
|
||||
::yrs/body (-> data
|
||||
(dissoc ::s/problems ::s/value)
|
||||
(dissoc ::s/problems ::s/value ::s/spec)
|
||||
(cond-> explain (assoc :explain explain)))})
|
||||
|
||||
(= code :params-validation)
|
||||
|
|
|
@ -516,6 +516,9 @@
|
|||
:media (count media)
|
||||
::l/sync? true)
|
||||
|
||||
(doseq [item media]
|
||||
(l/debug :hint "write penpot file media object" :id (:id item) ::l/sync? true))
|
||||
|
||||
(doto output
|
||||
(write-obj! file)
|
||||
(write-obj! media))
|
||||
|
@ -770,7 +773,7 @@
|
|||
(defn- lookup-index
|
||||
[id]
|
||||
(let [val (get-in @*state* [:index id])]
|
||||
(l/trace :fn "lookup-index" :id id :val val ::l/sync? true)
|
||||
(l/debug :fn "lookup-index" :id id :val val ::l/sync? true)
|
||||
(when (and (not (::ignore-index-errors? *options*)) (not val))
|
||||
(ex/raise :type :validation
|
||||
:code :incomplete-index
|
||||
|
@ -783,7 +786,7 @@
|
|||
index index]
|
||||
(if-let [id (first items)]
|
||||
(let [new-id (if (::overwrite? *options*) id (uuid/next))]
|
||||
(l/trace :fn "update-index" :id id :new-id new-id ::l/sync? true)
|
||||
(l/debug :fn "update-index" :id id :new-id new-id ::l/sync? true)
|
||||
(recur (rest items)
|
||||
(assoc index id new-id)))
|
||||
index)))
|
||||
|
@ -801,8 +804,7 @@
|
|||
(update-in [:metadata :id] lookup-index)
|
||||
|
||||
;; Relink paths with fill image
|
||||
(and (map? (:fill-image form))
|
||||
(= :path (:type form)))
|
||||
(map? (:fill-image form))
|
||||
(update-in [:fill-image :id] lookup-index)
|
||||
|
||||
;; This covers old shapes and the new :fills.
|
||||
|
|
|
@ -378,21 +378,6 @@
|
|||
[{:keys [::rpc/profile-id]} {:keys [modified-at revn]}]
|
||||
(str profile-id (dt/format-instant modified-at :iso) revn))
|
||||
|
||||
|
||||
|
||||
(sv/defmethod ::hey
|
||||
{::doc/added "1.17"
|
||||
::rpc/auth false}
|
||||
[_ _]
|
||||
(str (rand-int 100)))
|
||||
|
||||
(sv/defmethod ::ho
|
||||
{::doc/added "1.17"
|
||||
::rpc/auth false}
|
||||
[_ _]
|
||||
(str (rand-int 1000)))
|
||||
|
||||
|
||||
(sv/defmethod ::get-file
|
||||
"Retrieve a file by its ID. Only authenticated users."
|
||||
{::doc/added "1.17"
|
||||
|
|
|
@ -113,8 +113,15 @@
|
|||
(mapcat vals)
|
||||
(keep (fn [{:keys [type] :as obj}]
|
||||
(case type
|
||||
:path (get-in obj [:fill-image :id])
|
||||
:path (get-in obj [:fill-image :id])
|
||||
:bool (get-in obj [:fill-image :id])
|
||||
;; NOTE: because of some bug, we ended with
|
||||
;; many shape types having the ability to
|
||||
;; have fill-image attribute (which initially
|
||||
;; designed for :path shapes).
|
||||
:group (get-in obj [:fill-image :id])
|
||||
:image (get-in obj [:metadata :id])
|
||||
|
||||
nil))))
|
||||
pages (concat
|
||||
(vals (:pages-index data))
|
||||
|
|
|
@ -574,8 +574,11 @@
|
|||
(l/trace :hint "register cron task" :id id :cron (str cron))
|
||||
(db/exec-one! conn [sql:upsert-cron-task id (str cron) (str cron)]))))
|
||||
|
||||
(def sql:lock-cron-task
|
||||
"select id from scheduled_task where id=? for update skip locked")
|
||||
(defn- lock-scheduled-task!
|
||||
[conn id]
|
||||
(let [sql (str "SELECT id FROM scheduled_task "
|
||||
" WHERE id=? FOR UPDATE SKIP LOCKED")]
|
||||
(some? (db/exec-one! conn [sql (d/name id)]))))
|
||||
|
||||
(defn- execute-cron-task
|
||||
[{:keys [::db/pool] :as cfg} {:keys [id] :as task}]
|
||||
|
@ -583,11 +586,16 @@
|
|||
{:name (str "penpot/cront-task/" id)}
|
||||
(try
|
||||
(db/with-atomic [conn pool]
|
||||
(when (db/exec-one! conn [sql:lock-cron-task (d/name id)])
|
||||
(db/exec-one! conn ["SET statement_timeout=0;"])
|
||||
(db/exec-one! conn ["SET idle_in_transaction_session_timeout=0;"])
|
||||
(when (lock-scheduled-task! conn id)
|
||||
(l/trace :hint "cron: execute task" :task-id id)
|
||||
((:fn task) task)))
|
||||
((:fn task) task))
|
||||
(db/rollback! conn))
|
||||
|
||||
(catch InterruptedException _
|
||||
(l/debug :hint "cron: task interrupted" :task-id id))
|
||||
|
||||
(catch Throwable cause
|
||||
(binding [l/*context* (get-error-context cause task)]
|
||||
(l/error :hint "cron: unhandled exception on running task"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue