From ef50d344c97d4a25542c14ad8966b05ec4747834 Mon Sep 17 00:00:00 2001 From: saint Date: Sat, 17 Aug 2024 23:02:02 +1000 Subject: [PATCH] v0.42.1 Rewrite and simplication of concurrent-ruby support --- gossamer_forums.rb | 52 +++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/gossamer_forums.rb b/gossamer_forums.rb index 326ee2a..7c87ca5 100644 --- a/gossamer_forums.rb +++ b/gossamer_forums.rb @@ -1268,22 +1268,22 @@ class GossamerForumsImporter < ImportScripts::Base # Increment the post count for the topic post_number = fetch_db_topic_post_numbers(topic.id).to_i + 1 update_db_topic_post_numbers(topic.id, post_number) - end puts "TIJ GG post_id #{post_id}" - # Create the initial post in the new topic - post = Post.create!( - topic_id: topic.id, - user_id: discourse_user_id, - raw: sanitized_post_message, - created_at: Time.at(row['post_time']), - updated_at: Time.at(row['post_time']), - reads: post_views || 0 - ) -# post_number: post_number - post.custom_fields['original_gossamer_id'] = row['post_id'] - post.save! + # Create the initial post in the new topic + post = Post.create!( + topic_id: topic.id, + user_id: discourse_user_id, + raw: sanitized_post_message, + created_at: Time.at(row['post_time']), + updated_at: Time.at(row['post_time']), + reads: post_views || 0, + post_number: post_number + ) + post.custom_fields['original_gossamer_id'] = row['post_id'] + post.save! + end sqlite_mutex.synchronize do # Increment the post count for the topic and user @@ -1321,21 +1321,21 @@ class GossamerForumsImporter < ImportScripts::Base # Fetch the number of views the post has had reply_post_views = fetch_post_views(reply_row['post_id']) - end puts "TIJ JJ post_id #{post_id}" - # Create the reply post in the existing topic - post = Post.create!( - topic_id: topic.id, - user_id: reply_user_id, - raw: sanitized_reply_message, - created_at: Time.at(reply_row['post_time']), - updated_at: Time.at(reply_row['post_time']), - reads: reply_post_views || 0 - ) -# post_number: post_number - post.custom_fields['original_gossamer_id'] = reply_row['post_id'] - post.save! + # Create the reply post in the existing topic + post = Post.create!( + topic_id: topic.id, + user_id: reply_user_id, + raw: sanitized_reply_message, + created_at: Time.at(reply_row['post_time']), + updated_at: Time.at(reply_row['post_time']), + reads: reply_post_views || 0, + post_number: post_number + ) + post.custom_fields['original_gossamer_id'] = reply_row['post_id'] + post.save! + end puts "TIJ KK post_id #{post_id}" # Increment the post count for the topic and user