mirror of
https://github.com/penpot/penpot.git
synced 2025-06-14 09:11:39 +02:00
🎉 Add generic retry middleware for rpc methods.
This commit is contained in:
parent
6a6f88c6ef
commit
bf2a393fd3
3 changed files with 52 additions and 20 deletions
|
@ -14,6 +14,7 @@
|
|||
[app.loggers.audit :as audit]
|
||||
[app.metrics :as mtx]
|
||||
[app.rlimits :as rlm]
|
||||
[app.util.retry :as retry]
|
||||
[app.util.services :as sv]
|
||||
[clojure.spec.alpha :as s]
|
||||
[cuerdas.core :as str]
|
||||
|
@ -92,6 +93,7 @@
|
|||
(defn- wrap-impl
|
||||
[{:keys [audit] :as cfg} f mdata]
|
||||
(let [f (wrap-with-rlimits cfg f mdata)
|
||||
f (retry/wrap-retry cfg f mdata)
|
||||
f (wrap-with-metrics cfg f mdata)
|
||||
spec (or (::sv/spec mdata) (s/spec any?))
|
||||
auth? (:auth mdata true)]
|
||||
|
@ -99,7 +101,6 @@
|
|||
(l/trace :action "register" :name (::sv/name mdata))
|
||||
(with-meta
|
||||
(fn [params]
|
||||
|
||||
;; Raise authentication error when rpc method requires auth but
|
||||
;; no profile-id is found in the request.
|
||||
(when (and auth? (not (uuid? (:profile-id params))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue