Add optimistic lock to avoid race conditions when handling votes (#10196)

* Add optimistic lock to avoid race conditions when handling votes

* Force-reload polls when getting `ActiveRecord::StaleObjectError`
This commit is contained in:
ThibG 2019-03-06 19:53:57 +01:00 committed by Eugen Rochko
parent b3668a79ec
commit 96f905f409
4 changed files with 12 additions and 1 deletions

View file

@ -0,0 +1,6 @@
class AddLockVersionToPolls < ActiveRecord::Migration[5.2]
def change
add_column :polls, :lock_version, :integer, null: false, default: 0
end
end