0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-23 06:58:58 -05:00

🐛 Fix issue on climit when it is not enabled

This commit is contained in:
Andrey Antukh 2024-03-19 11:35:58 +01:00
parent 67cdaa397c
commit edb0408300

View file

@ -21,7 +21,6 @@
[app.worker :as-alias wrk] [app.worker :as-alias wrk]
[clojure.edn :as edn] [clojure.edn :as edn]
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[cuerdas.core :as str]
[datoteka.fs :as fs] [datoteka.fs :as fs]
[integrant.core :as ig] [integrant.core :as ig]
[promesa.exec :as px] [promesa.exec :as px]
@ -241,16 +240,15 @@
[{:keys [::label ::profile-id ::rpc/climit ::mtx/metrics] :as cfg} f] [{:keys [::label ::profile-id ::rpc/climit ::mtx/metrics] :as cfg} f]
(let [config (get climit ::config) (let [config (get climit ::config)
cache (get climit ::cache)] cache (get climit ::cache)]
(reduce (fn [handler [limit-id limit-key :as ckey]] (reduce (fn [handler [limit-id limit-key :as ckey]]
(let [config (get config limit-id)] (if-let [config (get config limit-id)]
(when-not config
(throw (IllegalArgumentException.
(str/ffmt "config not found for: %" limit-id))))
(fn [& params] (fn [& params]
(let [limiter (cache/get cache ckey (partial create-limiter config))] (let [limiter (cache/get cache ckey (partial create-limiter config))]
(invoke limiter metrics limit-id limit-key label profile-id handler params))))) (invoke limiter metrics limit-id limit-key label profile-id handler params)))
(do
(l/wrn :hint "config not found" :label label :id limit-id)
f)))
f f
(get-limits cfg)))) (get-limits cfg))))