From c3913e580cccfd076d92cb78346b4e849ab50066 Mon Sep 17 00:00:00 2001 From: Eugene Kenny Date: Thu, 2 Jul 2020 22:30:46 +0100 Subject: [PATCH] Revert "Cache tags_text to avoid computing tags each time when logging" This reverts commit 05060ddba170ccb3ba9ce48555ed45400fe1ea96. Tags are per-fiber, so they can't be cached in an instance variable. --- .../lib/active_support/tagged_logging.rb | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/activesupport/lib/active_support/tagged_logging.rb b/activesupport/lib/active_support/tagged_logging.rb index 71c099611c..ed551011a4 100644 --- a/activesupport/lib/active_support/tagged_logging.rb +++ b/activesupport/lib/active_support/tagged_logging.rb @@ -40,7 +40,6 @@ module ActiveSupport end def push_tags(*tags) - @tags_text = nil tags.flatten! tags.reject!(&:blank?) current_tags.concat tags @@ -48,12 +47,10 @@ module ActiveSupport end def pop_tags(size = 1) - @tags_text = nil current_tags.pop size end def clear_tags! - @tags_text = nil current_tags.clear end @@ -64,13 +61,11 @@ module ActiveSupport end def tags_text - @tags_text ||= begin - tags = current_tags - if tags.one? - "[#{tags[0]}] " - elsif tags.any? - tags.collect { |tag| "[#{tag}] " }.join - end + tags = current_tags + if tags.one? + "[#{tags[0]}] " + elsif tags.any? + tags.collect { |tag| "[#{tag}] " }.join end end end