Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
9f776707
Commit
9f776707
authored
Mar 06, 2018
by
Andreas Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Shortcut and return on duplicate record error.
parent
8e668076
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
app/models/user_interacted_project.rb
app/models/user_interacted_project.rb
+3
-3
No files found.
app/models/user_interacted_project.rb
View file @
9f776707
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment