From 5763ce876409700c21eefa847c2b8bc9bfec8d2f Mon Sep 17 00:00:00 2001 From: saint Date: Mon, 19 Aug 2024 11:37:12 +1000 Subject: [PATCH] v0.48.2 batch size 1000, moving to local instance of MariaDB for slowtwitch db --- gossamer_forums.rb | 60 +++++++++++++++++++--------------------------- 1 file changed, 24 insertions(+), 36 deletions(-) diff --git a/gossamer_forums.rb b/gossamer_forums.rb index 9b10d5e..15569b6 100644 --- a/gossamer_forums.rb +++ b/gossamer_forums.rb @@ -30,43 +30,31 @@ class GossamerForumsImporter < ImportScripts::Base super begin -# # Database configuration for ActiveRecord -# ActiveRecord::Base.establish_connection( -# adapter: 'mysql2', -# 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", -# username: "admin", -# password: "yxnh93Ybbz2Nm8#mp28zCVv", -# database: "slowtwitch" -# ) - # Database configuration for ActiveRecord ActiveRecord::Base.establish_connection( adapter: 'postgresql', - database: 'slowtwitch', - username: 'admin', - password: 'yxnh93Ybbz2Nm8#mp28zCVv', - host: 'slowtwitch.northend.network', + database: 'discourse', + username: 'discourse', + password: "nhB5FWhQkjdvaD2ViRNO63dQagDnzaTn", + host: '10.0.0.2', pool: 20, # Adjust based on concurrency needs timeout: 5000 ) # Initialize MySQL client to connect to Gossamer Forums database @mysql_client = Mysql2::Client.new( - host: "172.99.0.10", + host: "slowtwitch.northend.network", username: "admin", - password: "x0YGLA9252iiTFQuqaM0ROX8FmQzZuUu", + password: "yxnh93Ybbz2Nm8#mp28zCVv", database: "slowtwitch" ) +# # Initialize MySQL client to connect to Gossamer Forums database +# @mysql_client = Mysql2::Client.new( +# host: "172.99.0.10", +# username: "admin", +# password: "x0YGLA9252iiTFQuqaM0ROX8FmQzZuUu", +# database: "slowtwitch" +# ) rescue Mysql2::Error => e puts "Error connecting to MySQL: #{e.message}" @@ -1150,22 +1138,22 @@ class GossamerForumsImporter < ImportScripts::Base # 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 -# Mysql2::Client.new( -# host: "slowtwitch.northend.network", -# username: "admin", -# password: "yxnh93Ybbz2Nm8#mp28zCVv", -# database: "slowtwitch" -# ) -# end mariadb_pool = ConnectionPool.new(size: 24, timeout: 100) do Mysql2::Client.new( - host: "172.99.0.10", + host: "slowtwitch.northend.network", username: "admin", - password: "x0YGLA9252iiTFQuqaM0ROX8FmQzZuUu", + password: "yxnh93Ybbz2Nm8#mp28zCVv", database: "slowtwitch" ) end +# mariadb_pool = ConnectionPool.new(size: 24, timeout: 100) do +# Mysql2::Client.new( +# host: "172.99.0.10", +# username: "admin", +# password: "x0YGLA9252iiTFQuqaM0ROX8FmQzZuUu", +# database: "slowtwitch" +# ) +# end # The query selects post_ids from gforum_Post where post_root_id is 0, meaning these posts are the topic starters (OPs). # Execute the query and fetch the result @@ -1177,7 +1165,7 @@ class GossamerForumsImporter < ImportScripts::Base # parent_post_count = parent_post_ids.count # - batch_size = 10 # Set our batch size for number of posts to import in a single batch + batch_size = 100 # Set our batch size for number of posts to import in a single batch #### current_post_batch = 0 # Set our current batch number. This tracks the current batch of posts being processed.