A platform for community discussion. Free, open, simple.
PERF: bulk feature topic users & reset topic counters after an import
Régis Hanol1e67bcb4563d
diff --git a/script/import_scripts/base.rb b/script/import_scripts/base.rbindex 30dfb7cb080..93af4a7bba7 100644--- a/script/import_scripts/base.rb+++ b/script/import_scripts/base.rb@@ -782,26 +782,12 @@ class ImportScripts::Basedef update_feature_topic_usersputs "", "Updating featured topic users"-- 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+ TopicFeaturedUsers.ensure_consistency!enddef reset_topic_countersputs "", "Resetting topic counters"-- 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+ Topic.reset_all_highest!enddef update_category_featured_topics