Skip to content

Commit

Permalink
fix: Fixes possible wrong lost events count
Browse files Browse the repository at this point in the history
  • Loading branch information
Darkheir committed Jan 3, 2023
1 parent 6fba496 commit 586b64d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions reassembler.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ func (l *eventList) Clear() ([]*event, int) {
event := l.events[seq]

if l.lastSeq > 0 {
lost += int(seq - l.lastSeq - 1)
lost += int(seq) - int(l.lastSeq) - 1
}
l.lastSeq = seq
evicted = append(evicted, event)
Expand Down Expand Up @@ -302,7 +302,7 @@ func (l *eventList) CleanUp() ([]*event, int) {

if event.complete || size > l.maxSize || event.IsExpired() {
if l.lastSeq > 0 {
lost += int(seq - l.lastSeq - 1)
lost += int(seq) - int(l.lastSeq) - 1
}
l.lastSeq = seq
evicted = append(evicted, event)
Expand Down

0 comments on commit 586b64d

Please sign in to comment.