Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

recover from RecordNotUnique race condition when creating new legacy appeal #15391

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion app/models/legacy_appeal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,14 @@ def find_or_create_by_vacols_id(vacols_id)

fail ActiveRecord::RecordNotFound unless appeal.check_and_load_vacols_data!

appeal.save
# recover if another process has saved a record for this
# appeal since this method started
begin
appeal.save
rescue ActiveRecord::RecordNotUnique
appeal = find_by!(vacols_id: vacols_id)
end

appeal
end

Expand Down