Commit 5a1e5751 authored by Stan Hu's avatar Stan Hu

Merge branch 'georgekoltsov/update-import-object-builder-transaction' into 'master'

Update Import/Export ObjectBuilder to not use Project.transaction

See merge request gitlab-org/gitlab!79361
parents f98b3e38 30ef440f
...@@ -31,12 +31,18 @@ module Gitlab ...@@ -31,12 +31,18 @@ module Gitlab
def find def find
find_with_cache do find_with_cache do
find_object || klass.create(prepare_attributes) find_object || create_object
end end
end end
protected protected
def create_object
klass.transaction do
klass.create(prepare_attributes)
end
end
def where_clauses def where_clauses
raise NotImplementedError raise NotImplementedError
end end
......
...@@ -9,12 +9,6 @@ module Gitlab ...@@ -9,12 +9,6 @@ module Gitlab
# `Group::ObjectBuilder.build(Label, label_attributes)` # `Group::ObjectBuilder.build(Label, label_attributes)`
# finds or initializes a label with the given attributes. # finds or initializes a label with the given attributes.
class ObjectBuilder < Base::ObjectBuilder class ObjectBuilder < Base::ObjectBuilder
def self.build(*args)
::Group.transaction do
super
end
end
def initialize(klass, attributes) def initialize(klass, attributes)
super super
......
...@@ -13,14 +13,6 @@ module Gitlab ...@@ -13,14 +13,6 @@ module Gitlab
# #
# It also adds some logic around Group Labels/Milestones for edge cases. # It also adds some logic around Group Labels/Milestones for edge cases.
class ObjectBuilder < Base::ObjectBuilder class ObjectBuilder < Base::ObjectBuilder
def self.build(*args)
::Gitlab::Database::QueryAnalyzers::PreventCrossDatabaseModification.allow_cross_database_modification_within_transaction(url: 'https://gitlab.com/gitlab-org/gitlab/-/issues/350091') do
::Project.transaction do
super
end
end
end
def initialize(klass, attributes) def initialize(klass, attributes)
super super
......
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