PERFORMANCE: Remove WriteBatch, it's 100% redundant

Fixes #8155
This commit is contained in:
Armin 2017-09-06 22:13:42 +02:00 committed by Armin Braun
parent d82ba45d90
commit 340e879379
2 changed files with 3 additions and 47 deletions

View file

@ -343,7 +343,7 @@ module LogStash; module Util
end
def get_new_batch
WriteBatch.new
[]
end
def push(event)
@ -363,26 +363,5 @@ module LogStash; module Util
end
end
end
class WriteBatch
def initialize
@events = []
end
def size
@events.size
end
def push(event)
@events.push(event)
end
alias_method(:<<, :push)
def each(&blk)
@events.each do |e|
blk.call(e)
end
end
end
end
end end

View file

@ -247,7 +247,7 @@ module LogStash; module Util
end
def get_new_batch
WriteBatch.new
[]
end
def push(event)
@ -256,30 +256,7 @@ module LogStash; module Util
alias_method(:<<, :push)
def push_batch(batch)
LsQueueUtils.addAll(@queue, batch.events)
end
end
class WriteBatch
attr_reader :events
def initialize
@events = []
end
def size
@events.size
end
def push(event)
@events.push(event)
end
alias_method(:<<, :push)
def each(&blk)
@events.each do |e|
blk.call(e)
end
LsQueueUtils.addAll(@queue, batch)
end
end
end