Commit 6173727a authored by Douwe Maan's avatar Douwe Maan

Merge branch 'fix-transaction-shard' into 'master'

Fix transaction pollution in Shard.by_name

See merge request gitlab-org/gitlab-ce!23655
parents 005c4eff 5c45c21d
...@@ -18,7 +18,9 @@ class Shard < ActiveRecord::Base ...@@ -18,7 +18,9 @@ class Shard < ActiveRecord::Base
end end
def self.by_name(name) def self.by_name(name)
find_or_create_by(name: name) transaction(requires_new: true) do
find_or_create_by(name: name)
end
rescue ActiveRecord::RecordNotUnique rescue ActiveRecord::RecordNotUnique
retry retry
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