detect non streaming mode on the first read

This commit is contained in:
chrislu 2021-12-22 16:05:38 -08:00
parent 4c1368d621
commit 0ec7bc6710

View file

@ -11,7 +11,7 @@ type ReaderPattern struct {
func NewReaderPattern() *ReaderPattern {
return &ReaderPattern{
isStreaming: true,
lastReadOffset: 0,
lastReadOffset: -1,
}
}
@ -19,6 +19,11 @@ func (rp *ReaderPattern) MonitorReadAt(offset int64, size int) {
if rp.lastReadOffset > offset {
rp.isStreaming = false
}
if rp.lastReadOffset == -1 {
if offset != 0 {
rp.isStreaming = false
}
}
rp.lastReadOffset = offset
}