From 1b3e68f4307db58a676880637ce80de4e1f0b7bd Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Thu, 25 Jan 2024 09:38:08 +0100 Subject: [PATCH] :sparkles: Improve partitioning and graphics error skiping mechanism On the migration functions --- backend/src/app/features/components_v2.clj | 4 ++-- backend/src/app/srepl/components_v2.clj | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/backend/src/app/features/components_v2.clj b/backend/src/app/features/components_v2.clj index 915d08ab6..03068c6fc 100644 --- a/backend/src/app/features/components_v2.clj +++ b/backend/src/app/features/components_v2.clj @@ -1135,7 +1135,7 @@ (l/dbg :hint "migrate:file:start" :file-id (str file-id) :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)] (db/tx-run! system @@ -1183,7 +1183,7 @@ (migrate-file! system file-id :label label :validate? validate? - :skip-on-graphics-error? skip-on-graphic-error?)) + :skip-on-graphic-error? skip-on-graphic-error?)) migrate-team (fn [{:keys [::db/conn] :as system} team-id] (let [{:keys [id features]} (get-team system team-id)] diff --git a/backend/src/app/srepl/components_v2.clj b/backend/src/app/srepl/components_v2.clj index 4b042883f..e972f7796 100644 --- a/backend/src/app/srepl/components_v2.clj +++ b/backend/src/app/srepl/components_v2.clj @@ -235,7 +235,7 @@ (feat/migrate-team! team-id :label label :validate? validate? - :skip-on-graphics-error? skip-on-graphic-error?)) + :skip-on-graphic-error? skip-on-graphic-error?)) (print-stats! (-> (deref feat/*stats*) (assoc :elapsed (dt/format-duration (tpoint))))) @@ -266,6 +266,7 @@ :or {validate? false rollback? true max-jobs 1 + current-partition 1 skip-on-graphic-error? true max-items Long/MAX_VALUE}}] @@ -300,7 +301,7 @@ (feat/migrate-team! system team-id :label label :validate? validate? - :skip-on-graphics-error? skip-on-graphic-error?))) + :skip-on-graphic-error? skip-on-graphic-error?))) (when (string? label) (report! main/system team-id label (tpoint) nil)) @@ -333,9 +334,7 @@ :label label :rollback rollback? :max-jobs max-jobs - :max-items max-items - :partitions partitions - :current-partition current-partition) + :max-items max-items) (add-watch stats :progress-report (report-progress-teams tpoint on-progress)) @@ -359,9 +358,10 @@ (->> (get-teams conn query pred) (take max-items) (filter (fn [team-id] - (if (and (int? current-partition) (int? partitions)) - (let [partition (mod (uuid/hash-int team-id) partitions)] - (= (dec current-partition) partition)) + (if (int? partitions) + (= current-partition (-> (uuid/hash-int team-id) + (mod partitions) + (inc))) true))))) ;; Close and await tasks