mirror of
https://github.com/discourse/discourse.git
synced 2025-06-01 06:27:45 +08:00
Use DistributedMutex to make sure poll votes are tallied correctly.
This commit is contained in:
@ -143,6 +143,7 @@ module ::PollPlugin
|
||||
return if is_closed?
|
||||
|
||||
# Get the user's current vote.
|
||||
DistributedMutex.new(details_key).synchronize do
|
||||
vote = get_vote(user)
|
||||
vote = nil unless details.keys.include? vote
|
||||
|
||||
@ -153,6 +154,7 @@ module ::PollPlugin
|
||||
::PluginStore.set("poll", vote_key(user), option)
|
||||
set_details! new_details
|
||||
end
|
||||
end
|
||||
|
||||
def serialize(user)
|
||||
return nil if details.nil?
|
||||
|
Reference in New Issue
Block a user