diff options
author | Rémy Coutable <remy@rymai.me> | 2017-07-18 12:09:47 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-07-18 12:09:47 +0000 |
commit | f3e682c03fa84adea99d55ac74e32d53164cd99b (patch) | |
tree | 695c197151fe0ee2330db86328440fa6b390a49d /app/models/commit.rb | |
parent | f48264555563a906472795bc9fbccd09be4b6a47 (diff) | |
parent | f69c0f801f3db8cc534bc9652fbdb01bb15a5340 (diff) | |
download | gitlab-ce-f3e682c03fa84adea99d55ac74e32d53164cd99b.tar.gz |
Merge branch 'request-store-wrap' into 'master'
Add RequestCache to cache via RequestStore
See merge request !12920
Diffstat (limited to 'app/models/commit.rb')
-rw-r--r-- | app/models/commit.rb | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb index 21b906e1110..1e19f00106a 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -1,5 +1,6 @@ class Commit extend ActiveModel::Naming + extend Gitlab::Cache::RequestCache include ActiveModel::Conversion include Noteable @@ -169,19 +170,9 @@ class Commit end def author - if RequestStore.active? - key = "commit_author:#{author_email.downcase}" - # nil is a valid value since no author may exist in the system - if RequestStore.store.key?(key) - @author = RequestStore.store[key] - else - @author = find_author_by_any_email - RequestStore.store[key] = @author - end - else - @author ||= find_author_by_any_email - end + User.find_by_any_email(author_email.downcase) end + request_cache(:author) { author_email.downcase } def committer @committer ||= User.find_by_any_email(committer_email.downcase) @@ -368,10 +359,6 @@ class Commit end end - def find_author_by_any_email - User.find_by_any_email(author_email.downcase) - end - def repo_changes changes = { added: [], modified: [], removed: [] } |