Skip to content

Commit

Permalink
FIX: do not reset snapshot and once in tryFetch
Browse files Browse the repository at this point in the history
  • Loading branch information
kbearXD committed Nov 16, 2024
1 parent e0d3013 commit 986a567
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/depth/buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ func (b *Buffer) fetchAndPush() error {
if len(b.buffer) > 0 {
// the snapshot is too early
if finalUpdateID < b.buffer[0].FirstUpdateID {
b.resetSnapshot()
b.emitReset()
// reset buffer
b.buffer = nil
b.mu.Unlock()
return fmt.Errorf("depth snapshot is too early, final update %d is < the first update id %d", finalUpdateID, b.buffer[0].FirstUpdateID)
}
Expand All @@ -167,8 +167,8 @@ func (b *Buffer) fetchAndPush() error {
}

if u.FirstUpdateID > finalUpdateID+1 {
b.resetSnapshot()
b.emitReset()
// reset buffer
b.buffer = nil
b.mu.Unlock()
return fmt.Errorf("there is a missing depth update, the update id %d > final update id %d + 1", u.FirstUpdateID, finalUpdateID)
}
Expand Down

0 comments on commit 986a567

Please sign in to comment.