Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Brandl <abrandl@gitlab.com>2019-01-02 18:05:40 +0300
committerAndreas Brandl <abrandl@gitlab.com>2019-01-29 17:38:40 +0300
commit852e68fd952b18ba32b87c165bb17c370965d756 (patch)
tree3aea29b3ec0f8b138738b28885f1794ea7d40eac /lib/gitlab/github_import
parentfda30abdb2a88f360b20f99f3cefe0850d4e9f18 (diff)
Revert "Trigger iid logic from GitHub importer for milestones."
This reverts commit 358675d09f6ba0fdcc4a089c6d1da6df9ff6d092.
Diffstat (limited to 'lib/gitlab/github_import')
-rw-r--r--lib/gitlab/github_import/bulk_importing.rb4
-rw-r--r--lib/gitlab/github_import/importer/milestones_importer.rb12
2 files changed, 2 insertions, 14 deletions
diff --git a/lib/gitlab/github_import/bulk_importing.rb b/lib/gitlab/github_import/bulk_importing.rb
index da2f96b5c4b..147597289cf 100644
--- a/lib/gitlab/github_import/bulk_importing.rb
+++ b/lib/gitlab/github_import/bulk_importing.rb
@@ -15,12 +15,10 @@ module Gitlab
end
# Bulk inserts the given rows into the database.
- def bulk_insert(model, rows, batch_size: 100, pre_hook: nil)
+ def bulk_insert(model, rows, batch_size: 100)
rows.each_slice(batch_size) do |slice|
- pre_hook.call(slice) if pre_hook
Gitlab::Database.bulk_insert(model.table_name, slice)
end
- rows
end
end
end
diff --git a/lib/gitlab/github_import/importer/milestones_importer.rb b/lib/gitlab/github_import/importer/milestones_importer.rb
index 8d54b27374c..87cf2c8b598 100644
--- a/lib/gitlab/github_import/importer/milestones_importer.rb
+++ b/lib/gitlab/github_import/importer/milestones_importer.rb
@@ -19,20 +19,10 @@ module Gitlab
# rubocop: enable CodeReuse/ActiveRecord
def execute
- # We insert records in bulk, by-passing any standard model callbacks.
- # The pre_hook here makes sure we track internal ids consistently.
- # Note this has to be called before performing an insert of a batch
- # because we're outside a transaction scope here.
- bulk_insert(Milestone, build_milestones, pre_hook: method(:track_greatest_iid))
+ bulk_insert(Milestone, build_milestones)
build_milestones_cache
end
- def track_greatest_iid(slice)
- greatest_iid = slice.max { |e| e[:iid] }[:iid]
-
- InternalId.track_greatest(nil, { project: project }, :milestones, greatest_iid, ->(_) { project.milestones.maximum(:iid) })
- end
-
def build_milestones
build_database_rows(each_milestone)
end