Cache imported GH labels no matter what
This commit is contained in:
parent
6a9fb20fe1
commit
eaa0303b3d
1 changed files with 3 additions and 6 deletions
|
@ -52,15 +52,14 @@ module Gitlab
|
|||
fetch_resources(:labels, repo, per_page: 100) do |labels|
|
||||
labels.each do |raw|
|
||||
begin
|
||||
label = LabelFormatter.new(project, raw).create!
|
||||
@labels[label.title] = label.id
|
||||
LabelFormatter.new(project, raw).create!
|
||||
rescue => e
|
||||
errors << { type: :label, url: Gitlab::UrlSanitizer.sanitize(raw.url), errors: e.message }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
ensure_labels_are_cached
|
||||
cache_labels!
|
||||
end
|
||||
|
||||
def import_milestones
|
||||
|
@ -236,9 +235,7 @@ module Gitlab
|
|||
end
|
||||
end
|
||||
|
||||
def ensure_labels_are_cached
|
||||
return unless @labels.empty?
|
||||
|
||||
def cache_labels!
|
||||
project.labels.select(:id, :title).find_each do |label|
|
||||
@labels[label.title] = label.id
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue