Commit 9f776707 authored by Andreas Brandl's avatar Andreas Brandl

Shortcut and return on duplicate record error.

parent 8e668076
...@@ -30,9 +30,9 @@ class UserInteractedProject < ActiveRecord::Base ...@@ -30,9 +30,9 @@ class UserInteractedProject < ActiveRecord::Base
rescue ActiveRecord::RecordNotUnique rescue ActiveRecord::RecordNotUnique
# Note, above queries are not atomic and prone # Note, above queries are not atomic and prone
# to race conditions (similar like #find_or_create!). # to race conditions (similar like #find_or_create!).
# We retry and make sure the outer transaction (if any) # In the case where we hit this, the record we want
# is not aborted because of this. # already exists - shortcut and return.
retry true
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment