From 9aada2154d76e5b99a9f9d9c82956e32f38113c8 Mon Sep 17 00:00:00 2001 From: kbearXD Date: Sat, 16 Nov 2024 15:17:24 +0800 Subject: [PATCH] FIX: do not reset snapshot and once in tryFetch --- pkg/depth/buffer.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/depth/buffer.go b/pkg/depth/buffer.go index 5c9c6204a..30a3abd25 100644 --- a/pkg/depth/buffer.go +++ b/pkg/depth/buffer.go @@ -148,8 +148,8 @@ func (b *Buffer) fetchAndPush() error { if len(b.buffer) > 0 { // the snapshot is too early if finalUpdateID < b.buffer[0].FirstUpdateID-1 { - 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) } @@ -163,8 +163,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) }