aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support
diff options
context:
space:
mode:
authorSergey Nartimov <just.lest@gmail.com>2012-01-17 01:40:01 +0300
committerSergey Nartimov <just.lest@gmail.com>2012-01-17 01:40:01 +0300
commit6e76f8f5c05cb2f00d7a2f4d58e6dd35a23655f6 (patch)
tree08823ba15dce2cc982ea21ab52dbf270cb7d6ed4 /activesupport/lib/active_support
parent247d274cabae827766c1c5b9deb34fb34548fc5e (diff)
downloadrails-6e76f8f5c05cb2f00d7a2f4d58e6dd35a23655f6.tar.gz
rails-6e76f8f5c05cb2f00d7a2f4d58e6dd35a23655f6.tar.bz2
rails-6e76f8f5c05cb2f00d7a2f4d58e6dd35a23655f6.zip
use thread variable in TaggedLogging
previous solution can cause race conditions under GIL-free ruby implementations
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r--activesupport/lib/active_support/tagged_logging.rb5
1 files changed, 2 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/tagged_logging.rb b/activesupport/lib/active_support/tagged_logging.rb
index dc3ca25938..4e2e1a1ff5 100644
--- a/activesupport/lib/active_support/tagged_logging.rb
+++ b/activesupport/lib/active_support/tagged_logging.rb
@@ -14,7 +14,6 @@ module ActiveSupport
class TaggedLogging
def initialize(logger)
@logger = logger
- @tags = Hash.new { |h,k| h[k] = [] }
end
def tagged(*new_tags)
@@ -39,7 +38,7 @@ module ActiveSupport
end
def flush
- @tags.delete(Thread.current)
+ current_tags.clear
@logger.flush if @logger.respond_to?(:flush)
end
@@ -57,7 +56,7 @@ module ActiveSupport
end
def current_tags
- @tags[Thread.current]
+ Thread.current[:activesupport_tagged_logging_tags] ||= []
end
end
end