mcp: handle empty chunks in MemoryEventStore (#862)
When purging chunks, allow empty chunks without panicking. Fixes #860.
This commit is contained in:
parent
755b9ed4df
commit
150bca797d
1 changed files with 28 additions and 4 deletions
|
|
@ -376,10 +376,11 @@ func (s *MemoryEventStore) purge() {
|
|||
for _, dl := range sm {
|
||||
if dl.size > 0 {
|
||||
r := dl.removeFirst()
|
||||
if r > 0 {
|
||||
changed = true
|
||||
s.nBytes -= r
|
||||
}
|
||||
// Even if we remove an empty chunk, that's
|
||||
// still progress. There may be non-empty
|
||||
// chunks after it.
|
||||
changed = true
|
||||
s.nBytes -= r
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue