Skip to content

Commit

Permalink
last reviews comment
Browse files Browse the repository at this point in the history
  • Loading branch information
ph committed Nov 26, 2018
1 parent 75e0d51 commit 6e987e4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions filebeat/tests/system/test_harvester.py
Original file line number Diff line number Diff line change
Expand Up @@ -837,11 +837,11 @@ def test_debug_reader(self):
file = open(logfile, 'w', 0)
file.write("hello world1")
file.write("\n")
file.write("\x00")
file.write("\x00\x00\x00\x00")
file.write("\n")
file.write("hello world2")
file.write("\n")
file.write("\x00")
file.write("\x00\x00\x00\x00")
file.write("Hello World\n")
# Write some more data to hit the 16k min buffer size.
# Make it web safe.
Expand Down
6 changes: 3 additions & 3 deletions libbeat/reader/debug/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ func (r *Reader) Read(p []byte) (int, error) {
// cleanup any remaining bytes in the buffer.
if r.buffer.Len() > 0 {
r.predicate(r.offset, r.buffer.Bytes())
r.buffer = bytes.Buffer{}
}
r.buffer = bytes.Buffer{}
r.log.Info("Stopping debug reader, max execution reached")
r.state = stopped
return r.reader.Read(p)
Expand All @@ -108,7 +108,7 @@ func (r *Reader) Read(p []byte) (int, error) {
if r.failures < r.maxFailures && r.predicate(r.offset, r.buffer.Bytes()) {
r.failures++
}
r.buffer = bytes.Buffer{}
r.buffer.Reset()
}
r.offset += int64(n)
}
Expand Down Expand Up @@ -169,7 +169,7 @@ func AppendReaders(reader io.Reader) (io.Reader, error) {
reader,
defaultMinBuffer,
defaultMaxFailures,
makeNullCheck(log, 1),
makeNullCheck(log, 4),
); err != nil {
return nil, err
}
Expand Down

0 comments on commit 6e987e4

Please sign in to comment.