Created
July 26, 2013 08:26
-
-
Save repeatedly/6087206 to your computer and use it in GitHub Desktop.
Patch for TimeSlicedOutput#emit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/lib/fluent/output.rb b/lib/fluent/output.rb | |
| index 475a87b..476dba5 100644 | |
| --- a/lib/fluent/output.rb | |
| +++ b/lib/fluent/output.rb | |
| @@ -494,8 +494,10 @@ module Fluent | |
| end | |
| end | |
| - def emit(tag, es, chain) | |
| + def emit(tag, es, chain) | |
| @emit_count += 1 | |
| + | |
| + emits = {} | |
| es.each {|time,record| | |
| tc = time / @time_slice_cache_interval | |
| if @before_tc == tc | |
| @@ -505,10 +507,12 @@ module Fluent | |
| key = @time_slicer.call(time) | |
| @before_key = key | |
| end | |
| - data = format(tag, time, record) | |
| + (emits[key] ||= '') << format(tag, time, record) | |
| + } | |
| + emits.each { |key, data| | |
| if @buffer.emit(key, data, chain) | |
| submit_flush | |
| - end | |
| + end | |
| } | |
| end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment