From 8f80fbd19f209abab22bbee307626c02ce809911 Mon Sep 17 00:00:00 2001 From: saint Date: Sat, 17 Aug 2024 19:04:57 +1000 Subject: [PATCH] v0.41.2 Several bug fixes and improvements for fully concurrent topic-post import --- gossamer_forums.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/gossamer_forums.rb b/gossamer_forums.rb index 1431af0..7937f02 100644 --- a/gossamer_forums.rb +++ b/gossamer_forums.rb @@ -1275,10 +1275,11 @@ class GossamerForumsImporter < ImportScripts::Base # Import each reply sequentially replies.each do |reply_row| - begin +## begin # Fetch the discourse user ID for the reply reply_user_id = fetch_user_id_mapping(reply_row['user_id_fk']) + puts "TIJ II post_id #{post_id}" # Sanitize and prepare the reply message for Discourse sanitized_reply_message = sanitize_post_message(reply_row['post_message']) @@ -1291,6 +1292,7 @@ class GossamerForumsImporter < ImportScripts::Base # Fetch the number of views the post has had reply_post_views = fetch_post_views(reply_row['post_id']) + puts "TIJ JJ post_id #{post_id}" # Create the reply post in the existing topic post = Post.create!( topic_id: topic.id, @@ -1304,6 +1306,7 @@ class GossamerForumsImporter < ImportScripts::Base post.custom_fields['original_gossamer_id'] = reply_row['post_id'] post.save! + puts "TIJ KK post_id #{post_id}" # Increment the post count for the topic and user update_db_topic_post_count(topic.id, fetch_db_topic_post_count(topic.id).to_i + 1) update_db_user_post_count(reply_user_id, fetch_db_user_post_count(reply_user_id).to_i + 1) @@ -1321,9 +1324,9 @@ class GossamerForumsImporter < ImportScripts::Base # update_highest_processed_post_id_thread_safe(reply_row['post_id']) # rescue ActiveRecord::RecordInvalid => e - rescue => e - puts "Error importing reply with post_id #{reply_row['post_id']}: #{e.message}" - end +## rescue => e +## puts "Error importing reply with post_id #{reply_row['post_id']}: #{e.message}" +## end end # # After processing the entire topic, update the highest_processed_post_id to the current topic's post_id (thread-safe)