diff options
author | Stan Hu <stanhu@gmail.com> | 2019-07-24 18:01:44 +0000 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-07-24 18:01:44 +0000 |
commit | 0d538e44aff066372ecd9d10ac6786681bc347c9 (patch) | |
tree | 5a0fb1f83246d27a63f0d201c3fd11963f5b25de /lib | |
parent | f73d65197bfa3f608350f6f96e1445a7060d90e5 (diff) | |
parent | 8d1e97fc3b9af28d2a34d2b16239e52d3b5d0303 (diff) | |
download | gitlab-ce-0d538e44aff066372ecd9d10ac6786681bc347c9.tar.gz |
Merge branch 'optimise-import-performance' into 'master'
Optimise import performance
Closes #64924
See merge request gitlab-org/gitlab-ce!31045
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/import_export/attributes_finder.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/import_export/json_hash_builder.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/import_export/members_mapper.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/import_export/relation_factory.rb | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/lib/gitlab/import_export/attributes_finder.rb b/lib/gitlab/import_export/attributes_finder.rb index 409243e68a5..42cd94add79 100644 --- a/lib/gitlab/import_export/attributes_finder.rb +++ b/lib/gitlab/import_export/attributes_finder.rb @@ -45,7 +45,7 @@ module Gitlab end def key_from_hash(value) - value.is_a?(Hash) ? value.keys.first : value + value.is_a?(Hash) ? value.first.first : value end end end diff --git a/lib/gitlab/import_export/json_hash_builder.rb b/lib/gitlab/import_export/json_hash_builder.rb index b145f37c052..a92e3862361 100644 --- a/lib/gitlab/import_export/json_hash_builder.rb +++ b/lib/gitlab/import_export/json_hash_builder.rb @@ -27,7 +27,7 @@ module Gitlab # {:merge_requests=>[:merge_request_diff, :notes]} def process_model_objects(model_object_hash) json_config_hash = {} - current_key = model_object_hash.keys.first + current_key = model_object_hash.first.first model_object_hash.values.flatten.each do |model_object| @attributes_finder.parse(current_key) { |hash| json_config_hash[current_key] ||= hash } diff --git a/lib/gitlab/import_export/members_mapper.rb b/lib/gitlab/import_export/members_mapper.rb index ab19a509310..4e976cfca3a 100644 --- a/lib/gitlab/import_export/members_mapper.rb +++ b/lib/gitlab/import_export/members_mapper.rb @@ -35,7 +35,7 @@ module Gitlab end def include?(old_author_id) - map.keys.include?(old_author_id) && map[old_author_id] != default_user_id + map.has_key?(old_author_id) && map[old_author_id] != default_user_id end private diff --git a/lib/gitlab/import_export/relation_factory.rb b/lib/gitlab/import_export/relation_factory.rb index 1b545b1d049..0be49e27acb 100644 --- a/lib/gitlab/import_export/relation_factory.rb +++ b/lib/gitlab/import_export/relation_factory.rb @@ -185,7 +185,7 @@ module Gitlab return unless EXISTING_OBJECT_CHECK.include?(@relation_name) return unless @relation_hash['group_id'] - @relation_hash['group_id'] = @project.group&.id + @relation_hash['group_id'] = @project.namespace_id end def reset_tokens! |