diff options
author | Tomasz Maczukin <tomasz@maczukin.pl> | 2018-05-07 18:13:03 +0300 |
---|---|---|
committer | Tomasz Maczukin <tomasz@maczukin.pl> | 2018-05-07 18:17:45 +0300 |
commit | b817e1d0f5fd1f35c1fe1107ffb0e267a30c468f (patch) | |
tree | 93a9863d142d48ed2d44ecc612f791a5f3cfcc43 | |
parent | 7f544886670854a5261991888184c14ccff93099 (diff) |
Add memoization of commit related values in Ci::Pipeline
-rw-r--r-- | app/models/ci/pipeline.rb | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index b44012ddc59..1d2db14ce36 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -269,27 +269,39 @@ module Ci end def git_author_name - commit.try(:author_name) + strong_memoize(:git_author_name) do + commit.try(:author_name) + end end def git_author_email - commit.try(:author_email) + strong_memoize(:git_author_email) do + commit.try(:author_email) + end end def git_commit_message - commit.try(:message) + strong_memoize(:git_commit_message) do + commit.try(:message) + end end def git_commit_title - commit.try(:title) + strong_memoize(:git_commit_title) do + commit.try(:title) + end end def git_commit_full_title - commit.try(:full_title) + strong_memoize(:git_commit_full_title) do + commit.try(:full_title) + end end def git_commit_description - commit.try(:description) + strong_memoize(:git_commit_description) do + commit.try(:description) + end end def short_sha |