From 13e418e34e8422630ea02d23b9f3c8487b3f95ce Mon Sep 17 00:00:00 2001 From: ulferts Date: Fri, 23 Jul 2021 10:53:39 +0200 Subject: [PATCH] env var for aggregate journal migration batch size --- db/migrate/20210615150558_aggregate_journals.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/migrate/20210615150558_aggregate_journals.rb b/db/migrate/20210615150558_aggregate_journals.rb index b16e90ae02..1c6e90cb18 100644 --- a/db/migrate/20210615150558_aggregate_journals.rb +++ b/db/migrate/20210615150558_aggregate_journals.rb @@ -25,7 +25,7 @@ class AggregateJournals < ActiveRecord::Migration[6.1] # The change is irreversible (aggregated journals cannot be broken down) but down will not cause database inconsistencies. def aggregate_journals(klass) - klass.in_batches do |instances| + klass.in_batches(of: ENV["OPENPROJECT_MIGRATION_AGGREGATE_JOURNALS_BATCH_SIZE"]&.to_i || 1000) do |instances| # Instantiating is faster than calculating the aggregated journals multiple times. aggregated_journals = aggregated_journals_of(klass, instances).to_a