Skip to content

Commit e77ee28

Browse files
Watson1978kou
andcommitted
exec_util: re-use chunk buffer
Co-authored-by: Sutou Kouhei <kou@cozmixng.org> Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
1 parent 3676568 commit e77ee28

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

lib/fluent/compat/exec_util.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ class JSONParser < Parser
8181
def call(io)
8282
parser = JSON::ResumableParser.new({})
8383
begin
84-
while (chunk = io.readpartial(BYTES_TO_READ))
84+
chunk = +"".b
85+
while io.readpartial(BYTES_TO_READ, chunk)
8586
parser << chunk
8687
while parser.parse
8788
@on_message.call(parser.value)

0 commit comments

Comments
 (0)