Commit 5c45c21d authored by Nick Thomas's avatar Nick Thomas

Fix transaction pollution in Shard.by_name

parent 9ed1c2b5
...@@ -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