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:
6
db/migrate/20190306145741_add_lock_version_to_polls.rb
Normal file
6
db/migrate/20190306145741_add_lock_version_to_polls.rb
Normal 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
|
||||
|
Reference in New Issue
Block a user