PERF: bulk feature topic users & reset topic counters after an import
This commit is contained in:
parent
7401901939
commit
1e67bcb456
|
@ -782,26 +782,12 @@ class ImportScripts::Base
|
||||||
|
|
||||||
def update_feature_topic_users
|
def update_feature_topic_users
|
||||||
puts "", "Updating featured topic users"
|
puts "", "Updating featured topic users"
|
||||||
|
TopicFeaturedUsers.ensure_consistency!
|
||||||
count = 0
|
|
||||||
total = Topic.count
|
|
||||||
|
|
||||||
Topic.find_each do |topic|
|
|
||||||
topic.feature_topic_users
|
|
||||||
print_status(count += 1, total, get_start_time("feature_topic_user"))
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def reset_topic_counters
|
def reset_topic_counters
|
||||||
puts "", "Resetting topic counters"
|
puts "", "Resetting topic counters"
|
||||||
|
Topic.reset_all_highest!
|
||||||
count = 0
|
|
||||||
total = Topic.count
|
|
||||||
|
|
||||||
Topic.find_each do |topic|
|
|
||||||
Topic.reset_highest(topic.id)
|
|
||||||
print_status(count += 1, total, get_start_time("topic_counters"))
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_category_featured_topics
|
def update_category_featured_topics
|
||||||
|
|
Loading…
Reference in New Issue