BURs: lock posts when updating tags during bulk updates.
Fixes updates sometimes getting clobbered when multiple aliases or mass updates tried to update the same post at the same time.
This commit is contained in:
@@ -28,9 +28,10 @@ class TagBatchChangeJob < ApplicationJob
|
||||
|
||||
def migrate_posts(normalized_antecedent, normalized_consequent)
|
||||
::Post.tag_match(normalized_antecedent.join(" ")).find_each do |post|
|
||||
post.reload
|
||||
tags = (post.tag_array - normalized_antecedent + normalized_consequent).join(" ")
|
||||
post.update(tag_string: tags)
|
||||
post.with_lock do
|
||||
tags = (post.tag_array - normalized_antecedent + normalized_consequent).join(" ")
|
||||
post.update(tag_string: tags)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user