v0.45 SQLIte mutexes only wrap around updates now
This commit is contained in:
parent
90a2d2fa37
commit
0372db9cc7
@ -1,7 +1,7 @@
|
||||
# Federated Computer, Inc.
|
||||
# David Sainty <saint@federated.computer> 2024 A.D.
|
||||
# Gossamer Threads to Discourse -- Migration-Import Script
|
||||
# v0.44 Try removing connection_pool and starting MySQL within thread method and fix handle_post_attachment
|
||||
# v0.45 SQLIte mutexes only wrap around updates now
|
||||
|
||||
require 'mysql2'
|
||||
require 'open-uri'
|
||||
@ -1311,9 +1311,9 @@ class GossamerForumsImporter < ImportScripts::Base
|
||||
puts "CREATE TOPIC POST topic.id #{topic.id} discourse_user_id #{discourse_user_id}"
|
||||
|
||||
post_number = 0
|
||||
sqlite_mutex.synchronize do
|
||||
# Increment the post count for the topic
|
||||
post_number = fetch_db_topic_post_numbers(topic.id).to_i + 1
|
||||
sqlite_mutex.synchronize do
|
||||
update_db_topic_post_numbers(topic.id, post_number)
|
||||
end
|
||||
|
||||
@ -1361,10 +1361,11 @@ class GossamerForumsImporter < ImportScripts::Base
|
||||
|
||||
puts "CREATE REPLY in topic_id #{topic.id}"
|
||||
|
||||
sqlite_mutex.synchronize do
|
||||
# Increment the post count for the topic
|
||||
post_number = fetch_db_topic_post_numbers(topic.id).to_i + 1
|
||||
sqlite_mutex.synchronize do
|
||||
update_db_topic_post_numbers(topic.id, post_number)
|
||||
end
|
||||
|
||||
# Fetch the number of views the post has had
|
||||
reply_post_views = fetch_post_views(reply_row['post_id'])
|
||||
@ -1382,7 +1383,6 @@ class GossamerForumsImporter < ImportScripts::Base
|
||||
)
|
||||
post.custom_fields['original_gossamer_id'] = reply_row['post_id']
|
||||
post.save!
|
||||
end
|
||||
|
||||
puts "TIJ KK post_id #{post_id}"
|
||||
# Increment the post count for the topic and user
|
||||
|
Loading…
Reference in New Issue
Block a user