Skip to content

Commit

Permalink
Use File#size
Browse files Browse the repository at this point in the history
File#pos returns 0 since File#seek(0, IO::SEEK_SET) is called before

Signed-off-by: Yuta Iwama <[email protected]>
  • Loading branch information
ganmacs committed Aug 21, 2019
1 parent a2a164e commit 87944b8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/fluent/plugin/buffer/file_single_chunk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ def create_new_chunk(path, metadata, perm)
# If other cases are possible, we will change erorr handling with proper classes.
raise BufferOverflowError, "can't create buffer file for #{path}. Stop creating buffer files: error = #{e}"
end

@state = :unstaged
@bytesize = 0
@commit_position = @chunk.pos # must be 0
Expand Down Expand Up @@ -306,7 +306,7 @@ def load_existing_enqueued_chunk(path)

@state = :queued
@bytesize = @chunk.size
@commit_position = @chunk.pos
@commit_position = @chunk.size
end
end
end
Expand Down

0 comments on commit 87944b8

Please sign in to comment.