v0.40 Move to per thread MySQL/MariaDB connection

This commit is contained in:
David Sainty 2024-08-17 04:41:53 +10:00
parent 35b97db341
commit 168dcc9db7

View File

@ -1098,13 +1098,13 @@ class GossamerForumsImporter < ImportScripts::Base
# Initialise a new MariaDB / Mysql2 client inside of each thread # Initialise a new MariaDB / Mysql2 client inside of each thread
mysql_client = Mysql2::Client.new( mysql_client = Mysql2::Client.new(
host: "slowtwitch.northend.network", host: "slowtwitch.northend.network",
user: "admin", username: "admin",
password: "yxnh93Ybbz2Nm8#mp28zCVv", password: "yxnh93Ybbz2Nm8#mp28zCVv",
database: "slowtwitch" database: "slowtwitch"
) )
begin begin
puts "Processing post ID: #{post_id}" puts "Processing post ID: #{post_id}"
topic_import_job(post_idi, mysql_client) # Import topic and its replies topic_import_job(post_id, mysql_client) # Import topic and its replies
mark_post_as_complete(post_id) # Mark as complete in SQLite table mark_post_as_complete(post_id) # Mark as complete in SQLite table
rescue => e rescue => e
puts "Error processing post ID #{post_id}: #{e.message}" puts "Error processing post ID #{post_id}: #{e.message}"