Commit 431723a9 authored by Alexandru Croitor's avatar Alexandru Croitor

Reduce number mass inserts

When we run fixtures for CI we do not need masive mass
inserts and also for almost all cases we do not need to
involve mass inserts into other fixtures unless specifically
designed so or that increases fixture run times dramatically
parent 15166734
......@@ -4,7 +4,7 @@ class Gitlab::Seeder::Users
include ActionView::Helpers::NumberHelper
RANDOM_USERS_COUNT = 20
MASS_NAMESPACES_COUNT = 100
MASS_NAMESPACES_COUNT = ENV['CI'] ? 1 : 100
MASS_USERS_COUNT = ENV['CI'] ? 10 : 1_000_000
attr_reader :opts
......
......@@ -13,7 +13,7 @@ class Gitlab::Seeder::ProjectFeatures
Gitlab::Seeder.with_mass_insert(Project.count, "Project features") do
Project.each_batch(of: BATCH_SIZE) do |batch, index|
range = batch.pluck(Arel.sql('MIN(id)'), Arel.sql('MAX(id)')).first
count = index * BATCH_SIZE
count = index * batch.size
Gitlab::Seeder.log_message("Creating project features: #{count}.")
ActiveRecord::Base.connection.execute <<~SQL
......
......@@ -13,7 +13,7 @@ class Gitlab::Seeder::ProjectRoutes
Gitlab::Seeder.with_mass_insert(Project.count, "Project routes") do
Project.each_batch(of: BATCH_SIZE / 2) do |batch, index|
range = batch.pluck(Arel.sql('MIN(id)'), Arel.sql('MAX(id)')).first
count = index * BATCH_SIZE / 2
count = index * batch.size
Gitlab::Seeder.log_message("Creating project routes: #{count}.")
ActiveRecord::Base.connection.execute <<~SQL
......
......@@ -139,7 +139,7 @@ Gitlab::Seeder.quiet do
flag = 'SEED_PRODUCTIVITY_ANALYTICS'
if ENV[flag]
Project.find_each do |project|
Project.not_mass_generated.find_each do |project|
# This seed naively assumes that every project has a repository, and every
# repository has a `master` branch, which may be the case for a pristine
# GDK seed, but is almost never true for a GDK that's actually had
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment