FIX: Prevent race condition when post processing post (#8819)
If a post is being cooked twice (for example after an edit), there is a chance the 'raw' and 'cooked' column to be inconsistent. This reduces the chances of that happening.
This commit is contained in:
parent
e9b6b0194c
commit
f14dd1f82d
|
@ -7,6 +7,7 @@ module Jobs
|
|||
class ProcessPost < ::Jobs::Base
|
||||
|
||||
def execute(args)
|
||||
DistributedMutex.synchronize("process_post_#{args[:post_id]}") do
|
||||
post = Post.find_by(id: args[:post_id])
|
||||
# two levels of deletion
|
||||
return unless post.present? && post.topic.present?
|
||||
|
@ -47,6 +48,7 @@ module Jobs
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# onebox may have added some links, so extract them now
|
||||
def extract_links(post)
|
||||
|
|
Loading…
Reference in New Issue