mirror of
https://github.com/penpot/penpot.git
synced 2025-02-18 21:06:11 -05:00
🐛 Fix issues with not authenticated requests
Related to concurrency model refactor.
This commit is contained in:
parent
496ba433e9
commit
e15f5bb432
2 changed files with 10 additions and 19 deletions
|
@ -114,10 +114,7 @@
|
||||||
(if (= :none dname)
|
(if (= :none dname)
|
||||||
(with-meta
|
(with-meta
|
||||||
(fn [cfg params]
|
(fn [cfg params]
|
||||||
(try
|
(p/do! (f cfg params)))
|
||||||
(p/wrap (f cfg params))
|
|
||||||
(catch Throwable cause
|
|
||||||
(p/rejected cause))))
|
|
||||||
mdata)
|
mdata)
|
||||||
|
|
||||||
(let [executor (get executors dname)]
|
(let [executor (get executors dname)]
|
||||||
|
@ -173,13 +170,14 @@
|
||||||
(fn [{:keys [::request] :as params}]
|
(fn [{:keys [::request] :as params}]
|
||||||
;; Raise authentication error when rpc method requires auth but
|
;; Raise authentication error when rpc method requires auth but
|
||||||
;; no profile-id is found in the request.
|
;; no profile-id is found in the request.
|
||||||
(when (and auth? (not (uuid? (:profile-id params))))
|
(p/do!
|
||||||
|
(if (and auth? (not (uuid? (:profile-id params))))
|
||||||
(ex/raise :type :authentication
|
(ex/raise :type :authentication
|
||||||
:code :authentication-required
|
:code :authentication-required
|
||||||
:hint "authentication required for this endpoint"))
|
:hint "authentication required for this endpoint")
|
||||||
|
|
||||||
(let [params (us/conform spec (dissoc params ::request))]
|
(let [params (us/conform spec (dissoc params ::request))]
|
||||||
(f cfg (assoc params ::request request))))
|
(f cfg (assoc params ::request request))))))
|
||||||
|
|
||||||
mdata)))
|
mdata)))
|
||||||
|
|
||||||
(defn- process-method
|
(defn- process-method
|
||||||
|
|
|
@ -29,17 +29,10 @@
|
||||||
(if-let [max-retries (::max-retries mdata)]
|
(if-let [max-retries (::max-retries mdata)]
|
||||||
(fn [cfg params]
|
(fn [cfg params]
|
||||||
(letfn [(run [retry]
|
(letfn [(run [retry]
|
||||||
(prn "wrap-retry" "run" retry)
|
|
||||||
(try
|
|
||||||
(-> (f cfg params)
|
(-> (f cfg params)
|
||||||
(p/catch (partial handle-error retry)))
|
(p/catch (partial handle-error retry))))
|
||||||
(catch Throwable cause
|
|
||||||
(prn cause)
|
|
||||||
(throw cause))))
|
|
||||||
|
|
||||||
|
|
||||||
(handle-error [retry cause]
|
(handle-error [retry cause]
|
||||||
(prn "FOOFOFOF" retry (matches cause))
|
|
||||||
(if (matches cause)
|
(if (matches cause)
|
||||||
(let [current-retry (inc retry)]
|
(let [current-retry (inc retry)]
|
||||||
(l/trace :hint "running retry algorithm" :retry current-retry)
|
(l/trace :hint "running retry algorithm" :retry current-retry)
|
||||||
|
|
Loading…
Add table
Reference in a new issue