1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Revert "Cache tags_text to avoid computing tags each time when logging"

This reverts commit 05060ddba1.

Tags are per-fiber, so they can't be cached in an instance variable.
This commit is contained in:
Eugene Kenny 2020-07-02 22:30:46 +01:00
parent 86480e71fa
commit c3913e580c

View file

@ -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