diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2019-07-23 12:28:22 +0300 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2019-07-24 17:24:28 +0300 |
commit | 8d1e97fc3b9af28d2a34d2b16239e52d3b5d0303 (patch) | |
tree | c92a0bb3e09401c0c8e793cafc23b061d53a532e /lib/gitlab/import_export/relation_factory.rb | |
parent | 5e102f17f0ef16d0fd1eff98b9229fea2bc1fec9 (diff) |
Optimise import performance
- Fix `O(n)` complexity of `append_or_update_attribute`,
we append objects to an array and re-save project
- Remove the usage of `keys.include?` as it performs `O(n)`
search, instead use `.has_key?`
- Remove the usage of `.keys.first` as it performs a copy
of all keys, instead use `.first.first`
Diffstat (limited to 'lib/gitlab/import_export/relation_factory.rb')
-rw-r--r-- | lib/gitlab/import_export/relation_factory.rb | 2 |
1 files changed, 1 insertions, 1 deletions
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! |