diff options
author | Mario de la Ossa <mariodelaossa@gmail.com> | 2019-07-04 02:12:02 +0300 |
---|---|---|
committer | Mario de la Ossa <mariodelaossa@gmail.com> | 2019-07-11 06:35:43 +0300 |
commit | e5705f5c540755a672de5acf9d5710c24ccc6b27 (patch) | |
tree | ba5609a78b4b926c4a96f29668af76bd2bc12cf9 /lib/gitlab/markdown_cache | |
parent | 62e52ac6a8130c080f498ee2f76ef50b8c209f0f (diff) |
Banzai - avoid redis if attr is in DB cache
When cache_collection_render runs we end up reading and writing
things to redis even if we already have the rendered field cached
in the DB. This commit avoids using redis at all whenever we have
the field already rendered in the DB cache.
Diffstat (limited to 'lib/gitlab/markdown_cache')
-rw-r--r-- | lib/gitlab/markdown_cache/active_record/extension.rb | 4 | ||||
-rw-r--r-- | lib/gitlab/markdown_cache/redis/extension.rb | 4 |
2 files changed, 2 insertions, 6 deletions
diff --git a/lib/gitlab/markdown_cache/active_record/extension.rb b/lib/gitlab/markdown_cache/active_record/extension.rb index f3abe631779..233d3bf1ac7 100644 --- a/lib/gitlab/markdown_cache/active_record/extension.rb +++ b/lib/gitlab/markdown_cache/active_record/extension.rb @@ -26,10 +26,6 @@ module Gitlab attrs end - def changed_markdown_fields - changed_attributes.keys.map(&:to_s) & cached_markdown_fields.markdown_fields.map(&:to_s) - end - def write_markdown_field(field_name, value) write_attribute(field_name, value) end diff --git a/lib/gitlab/markdown_cache/redis/extension.rb b/lib/gitlab/markdown_cache/redis/extension.rb index 97fc23343b4..af3237f4ba6 100644 --- a/lib/gitlab/markdown_cache/redis/extension.rb +++ b/lib/gitlab/markdown_cache/redis/extension.rb @@ -36,8 +36,8 @@ module Gitlab false end - def changed_markdown_fields - [] + def changed_attributes + {} end def cached_markdown |