lib/fluent/engine.rb in fluentd-0.10.3 vs lib/fluent/engine.rb in fluentd-0.10.4
- old
+ new
@@ -89,25 +89,29 @@
def emit_array(tag, array)
emit_stream tag, ArrayEventStream.new(array)
end
def emit_stream(tag, es)
- match = @match_cache[tag]
- unless match
- match = @matches.find {|m| m.match(tag) } || NoMatchMatch.new
+ target = @match_cache[tag]
+ unless target
+ target = match(tag) || NoMatchMatch.new
if @match_cache.size < 1024 # TODO size limit
- @match_cache[tag] = match
+ @match_cache[tag] = target
end
end
- match.emit(tag, es)
+ target.emit(tag, es)
rescue
$log.warn "emit transaction faild ", :error=>$!.to_s
$log.warn_backtrace
raise
end
- def match?(tag)
+ def match(tag)
@matches.find {|m| m.match(tag) }
+ end
+
+ def match?(tag)
+ !!match(tag)
end
def flush!
flush_recursive(@matches)
end