v0.49 Work on MySQL brokenness

This commit is contained in:
David Sainty 2024-08-19 18:06:23 +10:00
parent 419af6d8cf
commit e9f5da7d02

View File

@ -1,7 +1,7 @@
# Federated Computer, Inc.
# David Sainty <saint@federated.computer> 2024 A.D.
# Gossamer Threads to Discourse -- Migration-Import Script
# v0.48.8 20-20-20, efforts to deal with MySQL connectionf failure issue
# v0.49 Work on Mysql brokenness
require 'mysql2'
require 'open-uri'
@ -30,17 +30,17 @@ class GossamerForumsImporter < ImportScripts::Base
super
begin
# Database configuration for ActiveRecord
# This is not used, except for pool size... issue with our Bitnami Discourse?
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
)
# # Database configuration for ActiveRecord
# # This is not used, except for pool size... issue with our Bitnami Discourse?
# 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(
@ -1127,11 +1127,11 @@ class GossamerForumsImporter < ImportScripts::Base
# Use CachedThreadPool for dynamic thread management
#### pool = Concurrent::CachedThreadPool.new
###### pool = Concurrent::FixedThreadPool.new(7)
pool = Concurrent::FixedThreadPool.new(12)
pool = Concurrent::FixedThreadPool.new(10)
# Define the connection pool inside the method
###### mariadb_pool = ConnectionPool.new(size: 14, timeout: 100) do
mariadb_pool = ConnectionPool.new(size: 24, timeout: 100) do
mariadb_pool = ConnectionPool.new(size: 10, timeout: 100) do
Mysql2::Client.new(
host: "slowtwitch.northend.network",
username: "admin",