mirror of
https://github.com/penpot/penpot.git
synced 2025-05-29 00:36:46 +02:00
✨ Reduce locking on objects-gc task
The main issue was the long running gc operation that affects storage objects with deduplication. The long running transacion ends locking some storage object rows which collaterally made operations like import-binfile become blocked indefinitelly because of the same rows (because of deduplication). The solution used in this commit is split operations on small chunks so we no longer use long running transactions that holds too many locks. With this approach we will make a window to work concurrently all operarate the distinct operations that requires locks on the same rows.
This commit is contained in:
parent
4c7a30a029
commit
584a0fdba1
11 changed files with 364 additions and 193 deletions
|
@ -35,6 +35,7 @@
|
|||
[app.util.pointer-map :as pmap]
|
||||
[app.util.services :as sv]
|
||||
[app.util.time :as dt]
|
||||
[app.worker :as wrk]
|
||||
[clojure.spec.alpha :as s]
|
||||
[cuerdas.core :as str]))
|
||||
|
||||
|
@ -916,7 +917,8 @@
|
|||
(db/update! conn :file
|
||||
{:deleted-at (dt/now)}
|
||||
{:id file-id}
|
||||
{::db/return-keys [:id :name :is-shared :project-id :created-at :modified-at]}))
|
||||
{::db/return-keys [:id :name :is-shared :deleted-at
|
||||
:project-id :created-at :modified-at]}))
|
||||
|
||||
(def ^:private
|
||||
schema:delete-file
|
||||
|
@ -929,6 +931,13 @@
|
|||
(check-edition-permissions! conn profile-id id)
|
||||
(let [file (mark-file-deleted! conn id)]
|
||||
|
||||
(wrk/submit! {::wrk/task :delete-object
|
||||
::wrk/delay (dt/duration "1m")
|
||||
::wrk/conn conn
|
||||
:object :file
|
||||
:deleted-at (:deleted-at file)
|
||||
:id id})
|
||||
|
||||
;; NOTE: when a file is a shared library, then we proceed to load
|
||||
;; the whole file, proceed with feature checking and properly execute
|
||||
;; the absorb-library procedure
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue