1
0
mirror of https://github.com/meineerde/rackstash.git synced 2025-12-19 15:01:12 +00:00

Synchronize FilterChain#to_s and FilterChain#inspect

This ensures that any access to the internal @filters array is only done
with an aquired lock to ensure data consistency.
This commit is contained in:
Holger Just 2017-08-02 17:23:47 +02:00
parent f6c5930db6
commit cbcfec88a8

View File

@ -227,8 +227,10 @@ module Rackstash
# @return [String] a string representation of `self` # @return [String] a string representation of `self`
def inspect def inspect
id_str = Object.instance_method(:to_s).bind(self).call[2..-2] synchronize do
"#<#{id_str} #{self}>" id_str = Object.instance_method(:to_s).bind(self).call[2..-2]
"#<#{id_str} #{self}>"
end
end end
# @return [Integer] the number of elements in `self`. May be zero. # @return [Integer] the number of elements in `self`. May be zero.
@ -259,7 +261,7 @@ module Rackstash
# @return [String] an Array-compatible string representation of `self` # @return [String] an Array-compatible string representation of `self`
def to_s def to_s
@filters.to_s synchronize { @filters.to_s }
end end
private private