v0.47.1 Fix .id nil bug

This commit is contained in:
David Sainty 2024-08-18 16:35:52 +10:00
parent 8caa2027cb
commit eb6ec24033

View File

@ -1,7 +1,7 @@
# Federated Computer, Inc. # Federated Computer, Inc.
# David Sainty <saint@federated.computer> 2024 A.D. # David Sainty <saint@federated.computer> 2024 A.D.
# Gossamer Threads to Discourse -- Migration-Import Script # Gossamer Threads to Discourse -- Migration-Import Script
# v0.47.1 Fix .id nil bug # v0.48 Further attempts to address MariaDB craziness
require 'mysql2' require 'mysql2'
require 'open-uri' require 'open-uri'
@ -18,6 +18,7 @@ require 'concurrent'
require 'sys/proctable' require 'sys/proctable'
require 'active_record'
require 'connection_pool' require 'connection_pool'
require File.expand_path("../../../../config/environment", __FILE__) require File.expand_path("../../../../config/environment", __FILE__)
@ -28,6 +29,18 @@ class GossamerForumsImporter < ImportScripts::Base
def initialize def initialize
super super
begin begin
# Database configuration for ActiveRecord
ActiveRecord::Base.establish_connection(
adapter: 'postgresql',
database: 'slowtwitch',
username: 'admin',
password: "yxnh93Ybbz2Nm8#mp28zCVv",
host: 'slowtwitch.northend.network',
pool: 20, # Adjust based on concurrency needs
timeout: 5000
)
# Initialize MySQL client to connect to Gossamer Forums database # Initialize MySQL client to connect to Gossamer Forums database
@mysql_client = Mysql2::Client.new( @mysql_client = Mysql2::Client.new(
host: "slowtwitch.northend.network", host: "slowtwitch.northend.network",
@ -1077,10 +1090,12 @@ class GossamerForumsImporter < ImportScripts::Base
# Use CachedThreadPool for dynamic thread management # Use CachedThreadPool for dynamic thread management
#### pool = Concurrent::CachedThreadPool.new #### pool = Concurrent::CachedThreadPool.new
pool = Concurrent::FixedThreadPool.new(7) ###### pool = Concurrent::FixedThreadPool.new(7)
pool = Concurrent::FixedThreadPool.new(12)
# Define the connection pool inside the method # Define the connection pool inside the method
mariadb_pool = ConnectionPool.new(size: 14, timeout: 100) do ###### mariadb_pool = ConnectionPool.new(size: 14, timeout: 100) do
mariadb_pool = ConnectionPool.new(size: 24, timeout: 100) do
Mysql2::Client.new( Mysql2::Client.new(
host: "slowtwitch.northend.network", host: "slowtwitch.northend.network",
username: "admin", username: "admin",