0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-24 23:49:45 -05:00

Improve partitioning and graphics error skiping mechanism

On the migration functions
This commit is contained in:
Andrey Antukh 2024-01-25 09:38:08 +01:00
parent 326be0df4f
commit 1b3e68f430
2 changed files with 10 additions and 10 deletions

View file

@ -1135,7 +1135,7 @@
(l/dbg :hint "migrate:file:start" (l/dbg :hint "migrate:file:start"
:file-id (str file-id) :file-id (str file-id)
:validate validate? :validate validate?
:skip-on-graphics-error skip-on-graphic-error?) :skip-on-graphic-error skip-on-graphic-error?)
(let [system (update system ::sto/storage media/configure-assets-storage)] (let [system (update system ::sto/storage media/configure-assets-storage)]
(db/tx-run! system (db/tx-run! system
@ -1183,7 +1183,7 @@
(migrate-file! system file-id (migrate-file! system file-id
:label label :label label
:validate? validate? :validate? validate?
:skip-on-graphics-error? skip-on-graphic-error?)) :skip-on-graphic-error? skip-on-graphic-error?))
migrate-team migrate-team
(fn [{:keys [::db/conn] :as system} team-id] (fn [{:keys [::db/conn] :as system} team-id]
(let [{:keys [id features]} (get-team system team-id)] (let [{:keys [id features]} (get-team system team-id)]

View file

@ -235,7 +235,7 @@
(feat/migrate-team! team-id (feat/migrate-team! team-id
:label label :label label
:validate? validate? :validate? validate?
:skip-on-graphics-error? skip-on-graphic-error?)) :skip-on-graphic-error? skip-on-graphic-error?))
(print-stats! (print-stats!
(-> (deref feat/*stats*) (-> (deref feat/*stats*)
(assoc :elapsed (dt/format-duration (tpoint))))) (assoc :elapsed (dt/format-duration (tpoint)))))
@ -266,6 +266,7 @@
:or {validate? false :or {validate? false
rollback? true rollback? true
max-jobs 1 max-jobs 1
current-partition 1
skip-on-graphic-error? true skip-on-graphic-error? true
max-items Long/MAX_VALUE}}] max-items Long/MAX_VALUE}}]
@ -300,7 +301,7 @@
(feat/migrate-team! system team-id (feat/migrate-team! system team-id
:label label :label label
:validate? validate? :validate? validate?
:skip-on-graphics-error? skip-on-graphic-error?))) :skip-on-graphic-error? skip-on-graphic-error?)))
(when (string? label) (when (string? label)
(report! main/system team-id label (tpoint) nil)) (report! main/system team-id label (tpoint) nil))
@ -333,9 +334,7 @@
:label label :label label
:rollback rollback? :rollback rollback?
:max-jobs max-jobs :max-jobs max-jobs
:max-items max-items :max-items max-items)
:partitions partitions
:current-partition current-partition)
(add-watch stats :progress-report (report-progress-teams tpoint on-progress)) (add-watch stats :progress-report (report-progress-teams tpoint on-progress))
@ -359,9 +358,10 @@
(->> (get-teams conn query pred) (->> (get-teams conn query pred)
(take max-items) (take max-items)
(filter (fn [team-id] (filter (fn [team-id]
(if (and (int? current-partition) (int? partitions)) (if (int? partitions)
(let [partition (mod (uuid/hash-int team-id) partitions)] (= current-partition (-> (uuid/hash-int team-id)
(= (dec current-partition) partition)) (mod partitions)
(inc)))
true))))) true)))))
;; Close and await tasks ;; Close and await tasks