summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeinrich Lee Yu <heinrich@gitlab.com>2018-11-23 17:28:13 +0800
committerHeinrich Lee Yu <heinrich@gitlab.com>2018-11-26 17:41:41 +0800
commit0c3005242734708e5282b2c8cd631e0a90ec15d1 (patch)
tree3749e90fad71ada4adcc6df13647c3d526932dee
parent6bb1a2ab23ba7729b1c9720296dfceb6079644c7 (diff)
downloadgitlab-ce-0c3005242734708e5282b2c8cd631e0a90ec15d1.tar.gz
Use strong memoize utility
-rw-r--r--lib/gitlab/cache/ci/project_pipeline_status.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/gitlab/cache/ci/project_pipeline_status.rb b/lib/gitlab/cache/ci/project_pipeline_status.rb
index 1bb839a274a..ea7013db2ce 100644
--- a/lib/gitlab/cache/ci/project_pipeline_status.rb
+++ b/lib/gitlab/cache/ci/project_pipeline_status.rb
@@ -7,6 +7,8 @@ module Gitlab
module Cache
module Ci
class ProjectPipelineStatus
+ include Gitlab::Utils::StrongMemoize
+
attr_accessor :sha, :status, :ref, :project, :loaded
def self.load_for_project(project)
@@ -112,9 +114,9 @@ module Gitlab
end
def commit
- return @commit if defined?(@commit)
-
- @commit = project.commit
+ strong_memoize(:commit) do
+ project.commit
+ end
end
end
end