From 524fae9283df9215222f2ab8c02e7a83acfd66a2 Mon Sep 17 00:00:00 2001 From: saint Date: Sat, 17 Aug 2024 03:06:07 +1000 Subject: [PATCH] v0.39.7 Fixes/tweaks in calculate_dynamic_pool_size --- gossamer_forums.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/gossamer_forums.rb b/gossamer_forums.rb index 52722a6..3e24d9e 100644 --- a/gossamer_forums.rb +++ b/gossamer_forums.rb @@ -1,7 +1,7 @@ # Federated Computer, Inc. # David Sainty 2024 A.D. # Gossamer Threads to Discourse -- Migration-Import Script -# v0.39.6 Fixes/tweaks in calculate_dynamic_pool_size +# v0.39.7 Fixes/tweaks in calculate_dynamic_pool_size require 'mysql2' require 'open-uri' @@ -1058,9 +1058,13 @@ class GossamerForumsImporter < ImportScripts::Base def threaded_topic_import # Get list of TOPICS / OP posts, i.e. post ids that have no parent / root id - SELECT post_id FROM gforum_Post WHERE post_root_id = 0; + # The query selects post_ids from gforum_Post where post_root_id is 0, meaning these posts are the topic starters (OPs). - # It also ensures that we only process posts with a post_id greater than the last processed one, allowing for resumption. - parent_post_ids = execute_query("SELECT post_id FROM gforum_Post WHERE post_root_id = 0 ORDER BY post_id ASC") + # Execute the query and fetch the result + result = execute_query("SELECT post_id FROM gforum_Post WHERE post_root_id = 0 ORDER BY post_id ASC") + + # Convert the result set to an array of post_ids + parent_post_ids = result.map { |row| row['post_id'] } parent_post_count = parent_post_ids.count batch_size = 100 # Set our batch size for number of posts to import in a single batch