diff options
author | Heinrich Lee Yu <heinrich@gitlab.com> | 2018-11-23 12:28:13 +0300 |
---|---|---|
committer | Heinrich Lee Yu <heinrich@gitlab.com> | 2018-11-26 12:41:41 +0300 |
commit | 0c3005242734708e5282b2c8cd631e0a90ec15d1 (patch) | |
tree | 3749e90fad71ada4adcc6df13647c3d526932dee /lib/gitlab/cache | |
parent | 6bb1a2ab23ba7729b1c9720296dfceb6079644c7 (diff) |
Use strong memoize utility
Diffstat (limited to 'lib/gitlab/cache')
-rw-r--r-- | lib/gitlab/cache/ci/project_pipeline_status.rb | 8 |
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 |