diff options
author | Robert Speicher <robert@gitlab.com> | 2016-01-06 21:11:46 +0300 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2016-01-06 21:11:46 +0300 |
commit | 623fa2caf70f9d1eef63fdbee448adedc4c0ede8 (patch) | |
tree | 8b6c1b25070f529927ffb5e1ba66b566f5972f84 /lib | |
parent | bcd2a09da72d430773b4b4bbc700132aade641d7 (diff) | |
parent | 18b17072c6cc7eb199d1da34a3ea481dcd53a8cf (diff) |
Merge branch 'fix-banzai-cache' into 'master'
Fix mentionable reference extraction caching.
Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/4130
Reverts https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/2120 and https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/2283
See merge request !2315
Diffstat (limited to 'lib')
-rw-r--r-- | lib/banzai/renderer.rb | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/lib/banzai/renderer.rb b/lib/banzai/renderer.rb index 910e1c6994e..891c0fd7749 100644 --- a/lib/banzai/renderer.rb +++ b/lib/banzai/renderer.rb @@ -18,22 +18,13 @@ module Banzai cache_key = context.delete(:cache_key) cache_key = full_cache_key(cache_key, context[:pipeline]) - cacheless = cacheless_render(text, context) - - if cache_key && ENV["DEBUG_BANZAI_CACHE"] - cached = Rails.cache.fetch(cache_key) { cacheless } - - if cached != cacheless - Rails.logger.warn "Banzai cache mismatch" - Rails.logger.warn "Text: #{text.inspect}" - Rails.logger.warn "Context: #{context.inspect}" - Rails.logger.warn "Cache key: #{cache_key.inspect}" - Rails.logger.warn "Cacheless: #{cacheless.inspect}" - Rails.logger.warn "With cache: #{cached.inspect}" + if cache_key + Rails.cache.fetch(cache_key) do + cacheless_render(text, context) end + else + cacheless_render(text, context) end - - cacheless end def self.render_result(text, context = {}) |