FIX: not hit Redis cache in seeds (#28329)

Hardcode IDs because seed in multisite environment is run concurrently which can cause performance problems.
This commit is contained in:
Krzysztof Kotlarek 2024-08-13 12:42:54 +10:00 committed by GitHub
parent 094052c1ff
commit 09262ac9b9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 26 additions and 37 deletions

View File

@ -1,55 +1,44 @@
# frozen_string_literal: true
post_action_type_view = PostActionTypeView.new
PostActionType.seed do |s|
s.id = post_action_type_view.types[:like]
s.id = 2
s.name_key = "like"
s.is_flag = false
s.icon = "heart"
s.position = 2
end
if post_action_type_view.types[:off_topic]
PostActionType.seed do |s|
s.id = post_action_type_view.types[:off_topic]
s.name_key = "off_topic"
s.is_flag = true
s.position = 3
end
PostActionType.seed do |s|
s.id = 3
s.name_key = "off_topic"
s.is_flag = true
s.position = 3
end
if post_action_type_view.types[:inappropriate]
PostActionType.seed do |s|
s.id = post_action_type_view.types[:inappropriate]
s.name_key = "inappropriate"
s.is_flag = true
s.position = 4
end
PostActionType.seed do |s|
s.id = 4
s.name_key = "inappropriate"
s.is_flag = true
s.position = 4
end
if post_action_type_view.types[:spam]
PostActionType.seed do |s|
s.id = post_action_type_view.types[:spam]
s.name_key = "spam"
s.is_flag = true
s.position = 6
end
PostActionType.seed do |s|
s.id = 8
s.name_key = "spam"
s.is_flag = true
s.position = 6
end
if post_action_type_view.types[:notify_user]
PostActionType.seed do |s|
s.id = post_action_type_view.types[:notify_user]
s.name_key = "notify_user"
s.is_flag = true
s.position = 7
end
PostActionType.seed do |s|
s.id = 6
s.name_key = "notify_user"
s.is_flag = true
s.position = 7
end
if post_action_type_view.types[:notify_moderators]
PostActionType.seed do |s|
s.id = post_action_type_view.types[:notify_moderators]
s.name_key = "notify_moderators"
s.is_flag = true
s.position = 8
end
PostActionType.seed do |s|
s.id = 7
s.name_key = "notify_moderators"
s.is_flag = true
s.position = 8
end