summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2016-05-04 00:59:20 -0700
committerStan Hu <stanhu@gmail.com>2016-05-04 09:22:01 -0700
commitb9672d4b38514a14cc39773d30f55c9629973f63 (patch)
treea31621ec1cb606c191b9d861b6d1e27a66a20f25
parent1a9d50597262a31f03dc66584f05d66b905d9d59 (diff)
downloadgitlab-ce-b9672d4b38514a14cc39773d30f55c9629973f63.tar.gz
Limit the number of merge requests per project to avoid long seeds
This step was taking a long time because seed_fu creates N / 2 merge requests for each repo, where N is the number of branches for that repo. At the time of this writing, there are 234 branches on the gitlab-ce repo, leading to 117 merge requests.
-rw-r--r--db/fixtures/development/10_merge_requests.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/db/fixtures/development/10_merge_requests.rb b/db/fixtures/development/10_merge_requests.rb
index 0825776ffaa..87fb8e3300d 100644
--- a/db/fixtures/development/10_merge_requests.rb
+++ b/db/fixtures/development/10_merge_requests.rb
@@ -1,6 +1,9 @@
Gitlab::Seeder.quiet do
+ # Limit the number of merge requests per project to avoid long seeds
+ MAX_NUM_MERGE_REQUESTS = 10
+
Project.all.reject(&:empty_repo?).each do |project|
- branches = project.repository.branch_names
+ branches = project.repository.branch_names.sample(MAX_NUM_MERGE_REQUESTS * 2)
branches.each do |branch_name|
break if branches.size < 2