mirror of
https://github.com/penpot/penpot.git
synced 2026-08-19 03:08:40 +00:00
🐛 Add concurrency limit to import-binfile RPC handler (#11024)
Apply climit with 4 global permits and 1 per-profile permit (queue 2) to prevent connection pool exhaustion from concurrent imports. Each import holds a DB connection for its entire duration with idle transaction timeout disabled, so unbounded concurrency could exhaust the pool (default 60 connections). AI-assisted-by: mimo-v2.5-pro
This commit is contained in:
parent
aecfee0f02
commit
3033da4409
@ -45,4 +45,10 @@
|
|||||||
{:permits 4}
|
{:permits 4}
|
||||||
|
|
||||||
:send-user-feedback/by-profile
|
:send-user-feedback/by-profile
|
||||||
{:permits 1 :queue 3}}
|
{:permits 1 :queue 3}
|
||||||
|
|
||||||
|
:import-binfile/global
|
||||||
|
{:permits 4}
|
||||||
|
|
||||||
|
:import-binfile/by-profile
|
||||||
|
{:permits 1 :queue 2}}
|
||||||
|
|||||||
@ -21,6 +21,7 @@
|
|||||||
[app.loggers.webhooks :as-alias webhooks]
|
[app.loggers.webhooks :as-alias webhooks]
|
||||||
[app.media.validation :as media.v]
|
[app.media.validation :as media.v]
|
||||||
[app.rpc :as-alias rpc]
|
[app.rpc :as-alias rpc]
|
||||||
|
[app.rpc.climit :as-alias climit]
|
||||||
[app.rpc.commands.files :as files]
|
[app.rpc.commands.files :as files]
|
||||||
[app.rpc.commands.media :as media-cmd]
|
[app.rpc.commands.media :as media-cmd]
|
||||||
[app.rpc.commands.projects :as projects]
|
[app.rpc.commands.projects :as projects]
|
||||||
@ -142,7 +143,9 @@
|
|||||||
|
|
||||||
::webhooks/event? true
|
::webhooks/event? true
|
||||||
::sse/stream? true
|
::sse/stream? true
|
||||||
::sm/params schema:import-binfile}
|
::sm/params schema:import-binfile
|
||||||
|
::climit/id [[:import-binfile/by-profile ::rpc/profile-id]
|
||||||
|
[:import-binfile/global]]}
|
||||||
[{:keys [::db/pool] :as cfg} {:keys [::rpc/profile-id project-id version upload-id] :as params}]
|
[{:keys [::db/pool] :as cfg} {:keys [::rpc/profile-id project-id version upload-id] :as params}]
|
||||||
(projects/check-edition-permissions! pool profile-id project-id)
|
(projects/check-edition-permissions! pool profile-id project-id)
|
||||||
(let [version (or version 3)
|
(let [version (or version 3)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user