BigW Consortium Gitlab

Skip MR metrics when importing projects from GitHub

parent 336ba94a
...@@ -3,4 +3,7 @@ module Importable ...@@ -3,4 +3,7 @@ module Importable
attr_accessor :importing attr_accessor :importing
alias_method :importing?, :importing alias_method :importing?, :importing
attr_accessor :skip_metrics
alias_method :skip_metrics?, :skip_metrics
end end
...@@ -14,6 +14,7 @@ module Issuable ...@@ -14,6 +14,7 @@ module Issuable
include Awardable include Awardable
include Taskable include Taskable
include TimeTrackable include TimeTrackable
include Importable
# This object is used to gather issuable meta data for displaying # This object is used to gather issuable meta data for displaying
# upvotes, downvotes, notes and closing merge requests count for issues and merge requests # upvotes, downvotes, notes and closing merge requests count for issues and merge requests
...@@ -99,7 +100,7 @@ module Issuable ...@@ -99,7 +100,7 @@ module Issuable
acts_as_paranoid acts_as_paranoid
after_save :update_assignee_cache_counts, if: :assignee_id_changed? 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 def update_assignee_cache_counts
# make sure we flush the cache for both the old *and* new assignees(if they exist) # make sure we flush the cache for both the old *and* new assignees(if they exist)
......
...@@ -3,7 +3,6 @@ class MergeRequest < ActiveRecord::Base ...@@ -3,7 +3,6 @@ class MergeRequest < ActiveRecord::Base
include Issuable include Issuable
include Referable include Referable
include Sortable include Sortable
include Importable
belongs_to :target_project, class_name: "Project" belongs_to :target_project, class_name: "Project"
belongs_to :source_project, class_name: "Project" belongs_to :source_project, class_name: "Project"
......
...@@ -20,7 +20,8 @@ module Gitlab ...@@ -20,7 +20,8 @@ module Gitlab
author_id: author_id, author_id: author_id,
assignee_id: assignee_id, assignee_id: assignee_id,
created_at: raw_data.created_at, created_at: raw_data.created_at,
updated_at: raw_data.updated_at updated_at: raw_data.updated_at,
skip_metrics: true
} }
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment