Skip to content

Commit

Permalink
fix: Resolve missing lines at end of streams due to harvester early f…
Browse files Browse the repository at this point in the history
…ailure
  • Loading branch information
driskell committed Feb 26, 2024
1 parent 463ed63 commit 710fc3c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lc-lib/harvester/linereader.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,20 @@ func (lr *LineReader) fill() error {
lr.end -= lr.start
lr.start = 0
}
if lr.err != nil {
// Return existing error - we will have errored with received data and
// returned a few times without error from that buffer, but now we need
// to propogate that error
return lr.err
}

n, err := lr.rd.Read(lr.buf[lr.end:])
lr.end += n
if err != nil {
// Remember last error - so we can continue processing current buffer and once
// we hit the end of it we return the existing error
lr.err = err
}

return err
}

0 comments on commit 710fc3c

Please sign in to comment.