diff --git a/gossamer_forums.rb b/gossamer_forums.rb index fb1cc0d..e540c9c 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.47.1 Fix .id nil bug +# v0.48 Further attempts to address MariaDB craziness require 'mysql2' require 'open-uri' @@ -18,6 +18,7 @@ require 'concurrent' require 'sys/proctable' +require 'active_record' require 'connection_pool' require File.expand_path("../../../../config/environment", __FILE__) @@ -28,6 +29,18 @@ class GossamerForumsImporter < ImportScripts::Base def initialize super 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 @mysql_client = Mysql2::Client.new( host: "slowtwitch.northend.network", @@ -1077,10 +1090,12 @@ class GossamerForumsImporter < ImportScripts::Base # Use CachedThreadPool for dynamic thread management #### 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 - 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( host: "slowtwitch.northend.network", username: "admin",