diff options
author | Oswaldo Ferreira <oswaldo@gitlab.com> | 2017-12-07 20:41:30 +0300 |
---|---|---|
committer | Oswaldo Ferreira <oswaldo@gitlab.com> | 2018-01-02 22:45:25 +0300 |
commit | bf8c20729baffbf55605484230ff33680d72139b (patch) | |
tree | 70d9bea9ea2a37dc8cd8c37cda396fcf246db72b /app/models/concerns/issuable.rb | |
parent | 2cbb2d0eceaed0f31c92d4eed8932e98f4f74559 (diff) |
Cache merged and closed events data in merge_request_metrics table
Diffstat (limited to 'app/models/concerns/issuable.rb')
-rw-r--r-- | app/models/concerns/issuable.rb | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/app/models/concerns/issuable.rb b/app/models/concerns/issuable.rb index 5ca4a7086cb..4251561a0a0 100644 --- a/app/models/concerns/issuable.rb +++ b/app/models/concerns/issuable.rb @@ -96,7 +96,7 @@ module Issuable strip_attributes :title - after_save :record_metrics, unless: :imported? + after_save :ensure_metrics, unless: :imported? # We want to use optimistic lock for cases when only title or description are involved # http://api.rubyonrails.org/classes/ActiveRecord/Locking/Optimistic.html @@ -335,11 +335,6 @@ module Issuable false end - def record_metrics - metrics = self.metrics || create_metrics - metrics.record! - end - ## # Override in issuable specialization # @@ -347,6 +342,10 @@ module Issuable false end + def ensure_metrics + self.metrics || create_metrics + end + ## # Overriden in MergeRequest # |