diff options
author | Douwe Maan <douwe@gitlab.com> | 2016-01-06 15:25:13 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2016-01-06 15:25:13 +0300 |
commit | b9ed3961b55cf3dbc1a6d4c841d295dd23161c90 (patch) | |
tree | 1b2457879ccdb238bdea2c534199e89f32e161cb /lib | |
parent | 95b1adb3394851132ea7ecb3104e9a857bdad82f (diff) |
Revert "Add DEBUG_BANZAI_CACHE env var to debug Banzai cache issue."
This reverts commit 4b027bc93a7875c3937f6b90ac1049b4a4d72da5.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/banzai/renderer.rb | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/lib/banzai/renderer.rb b/lib/banzai/renderer.rb index 910e1c6994e..115ae914524 100644 --- a/lib/banzai/renderer.rb +++ b/lib/banzai/renderer.rb @@ -1,5 +1,7 @@ module Banzai module Renderer + CACHE_ENABLED = false + # Convert a Markdown String into an HTML-safe String of HTML # # Note that while the returned HTML will have been sanitized of dangerous @@ -18,22 +20,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 && CACHE_ENABLED + 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 = {}) |