Skip to content

Commit 47aa67e

Browse files
committed
feat: include 'heavy load' mode for DB seeds
1 parent 484685a commit 47aa67e

File tree

4 files changed

+18
-23
lines changed

4 files changed

+18
-23
lines changed

Gemfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ group :development, :test do
3838
gem "dotenv-rails"
3939
gem "factory_bot_rails"
4040
gem "faker"
41-
gem "memory_profiler"
4241
gem "rspec-rails"
4342
gem "rubocop-rails-omakase", require: false
4443
end

Gemfile.lock

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,6 @@ GEM
252252
net-smtp
253253
marcel (1.0.4)
254254
matrix (0.4.3)
255-
memory_profiler (1.1.0)
256255
mini_magick (5.3.0)
257256
logger
258257
mini_mime (1.1.5)
@@ -545,7 +544,6 @@ DEPENDENCIES
545544
jbuilder
546545
kamal
547546
letter_opener
548-
memory_profiler
549547
mission_control-jobs
550548
ox
551549
pagy

app/services/xml_generator/single_provider.rb

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -42,26 +42,6 @@ def provider_xml(provider)
4242
end
4343
end
4444
end
45-
# xml.content_provider(name: provider.name) {
46-
# grouped_topics(provider).each do |(year, month), topics|
47-
# xml.topic_year(year: year) {
48-
# xml.topic_month(month: month) {
49-
# topics.each do |topic|
50-
# xml.title(name: topic.title) {
51-
# xml.topic_id topic.id
52-
# xml.topic_files(files: "Files") {
53-
# topic.documents.each_with_index do |document, index|
54-
# next if document.content_type == "video/mp4"
55-
# xml.send("file_name_#{index + 1}", document.filename, file_size: document.byte_size)
56-
# end
57-
# }
58-
# xml.topic_tags topic.current_tags_list.join(", ")
59-
# }
60-
# end
61-
# }
62-
# }
63-
# end
64-
# }
6545
end
6646

6747
def grouped_topics(prov)

db/seeds.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,21 @@
107107
end
108108

109109
puts "Users created!"
110+
111+
if ENV["SEED_MODE_HEAVY_LOAD"]
112+
times = ENV["SEED_MODE_HEAVY_LOAD"].to_i
113+
times.times do
114+
provider = Provider.find_or_create_by!(name: Faker::Company.name, provider_type: "government")
115+
times.times do
116+
Topic.find_or_create_by!(
117+
title: Faker::Book.title,
118+
description: Faker::Lorem.paragraph,
119+
language_id: Language.first.id,
120+
provider_id: provider.id,
121+
uid: SecureRandom.uuid,
122+
published_at: Time.now - rand(1..365).days,
123+
state: [ :active, :archived ].sample,
124+
)
125+
end
126+
end
127+
end

0 commit comments

Comments
 (0)