Skip MR metrics when importing projects from GitHub

This commit is contained in:
Douglas Barbosa Alexandre 2017-03-27 11:43:35 -03:00
parent 336ba94a7b
commit 20486593bd
4 changed files with 7 additions and 3 deletions

View File

@ -3,4 +3,7 @@ module Importable
attr_accessor :importing
alias_method :importing?, :importing
attr_accessor :skip_metrics
alias_method :skip_metrics?, :skip_metrics
end

View File

@ -14,6 +14,7 @@ module Issuable
include Awardable
include Taskable
include TimeTrackable
include Importable
# This object is used to gather issuable meta data for displaying
# upvotes, downvotes, notes and closing merge requests count for issues and merge requests
@ -99,7 +100,7 @@ module Issuable
acts_as_paranoid
after_save :update_assignee_cache_counts, if: :assignee_id_changed?
after_save :record_metrics
after_save :record_metrics, unless: :skip_metrics?
def update_assignee_cache_counts
# make sure we flush the cache for both the old *and* new assignees(if they exist)

View File

@ -3,7 +3,6 @@ class MergeRequest < ActiveRecord::Base
include Issuable
include Referable
include Sortable
include Importable
belongs_to :target_project, class_name: "Project"
belongs_to :source_project, class_name: "Project"

View File

@ -20,7 +20,8 @@ module Gitlab
author_id: author_id,
assignee_id: assignee_id,
created_at: raw_data.created_at,
updated_at: raw_data.updated_at
updated_at: raw_data.updated_at,
skip_metrics: true
}
end