Use strong memoize utility

This commit is contained in:
Heinrich Lee Yu 2018-11-23 17:28:13 +08:00
parent 6bb1a2ab23
commit 0c30052427
No known key found for this signature in database
GPG Key ID: 6EDB5D452716DE6B
1 changed files with 5 additions and 3 deletions

View File

@ -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