v0.52 Improve handling and look at how we can improve ActiveRecord config for PostgreSQL and avoid insufficient pool size
This commit is contained in:
parent
6360e99a96
commit
bcc7519d78
@ -1075,10 +1075,10 @@ class GossamerForumsImporter < ImportScripts::Base
|
|||||||
# Get list of TOPICS / OP posts, i.e. post ids that have no parent / root id - SELECT post_id FROM gforum_Post WHERE post_root_id = 0;
|
# Get list of TOPICS / OP posts, i.e. post ids that have no parent / root id - SELECT post_id FROM gforum_Post WHERE post_root_id = 0;
|
||||||
def threaded_topic_import
|
def threaded_topic_import
|
||||||
|
|
||||||
# Update connection pool settings
|
## # Update connection pool settings
|
||||||
ActiveRecord::Base.establish_connection(
|
## ActiveRecord::Base.establish_connection(
|
||||||
ActiveRecord::Base.connection_db_config.configuration_hash.merge(pool: 40, timeout: 5000)
|
## ActiveRecord::Base.connection_db_config.configuration_hash.merge(pool: 40, timeout: 5000)
|
||||||
)
|
## )
|
||||||
|
|
||||||
### # Define the custom connection pool settings
|
### # Define the custom connection pool settings
|
||||||
### custom_pool = ActiveRecord::ConnectionAdapters::ConnectionPool.new(
|
### custom_pool = ActiveRecord::ConnectionAdapters::ConnectionPool.new(
|
||||||
@ -1184,9 +1184,9 @@ class GossamerForumsImporter < ImportScripts::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Use connection pooling for PostgreSQL and synchronize access to shared resources
|
# Use connection pooling for PostgreSQL and synchronize access to shared resources
|
||||||
# ActiveRecord::Base.connection_pool.with_connection do
|
ActiveRecord::Base.connection_pool.with_connection do
|
||||||
# ActiveRecord::Base.connected_to(pool: 'CustomPool') do
|
# ActiveRecord::Base.connected_to(pool: 'CustomPool') do
|
||||||
ActiveRecord::Base.connected_to(role: :writing) do
|
## ActiveRecord::Base.connected_to(role: :writing) do
|
||||||
post_status = fetch_post_status(post_id)
|
post_status = fetch_post_status(post_id)
|
||||||
if post_status.nil? || post_status == 0
|
if post_status.nil? || post_status == 0
|
||||||
puts "Starting import for post_id #{post_id}"
|
puts "Starting import for post_id #{post_id}"
|
||||||
@ -1514,7 +1514,7 @@ class GossamerForumsImporter < ImportScripts::Base
|
|||||||
|
|
||||||
rescue ActiveRecord::RecordInvalid => e
|
rescue ActiveRecord::RecordInvalid => e
|
||||||
puts "---> ERROR importing topic with post_id #{row['post_id']}: #{e.message}"
|
puts "---> ERROR importing topic with post_id #{row['post_id']}: #{e.message}"
|
||||||
# raise ActiveRecord::Rollback
|
raise ActiveRecord::Rollback
|
||||||
end
|
end
|
||||||
# end
|
# end
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user