FIX: do not reset snapshot and once in tryFetch

This commit is contained in:
kbearXD 2024-11-16 15:17:24 +08:00
parent 89e6a4d372
commit 9aada2154d

View File

@ -148,8 +148,8 @@ func (b *Buffer) fetchAndPush() error {
if len(b.buffer) > 0 { if len(b.buffer) > 0 {
// the snapshot is too early // the snapshot is too early
if finalUpdateID < b.buffer[0].FirstUpdateID-1 { if finalUpdateID < b.buffer[0].FirstUpdateID-1 {
b.resetSnapshot() // reset buffer
b.emitReset() b.buffer = nil
b.mu.Unlock() 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) 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 { if u.FirstUpdateID > finalUpdateID+1 {
b.resetSnapshot() // reset buffer
b.emitReset() b.buffer = nil
b.mu.Unlock() b.mu.Unlock()
return fmt.Errorf("there is a missing depth update, the update id %d > final update id %d + 1", u.FirstUpdateID, finalUpdateID) return fmt.Errorf("there is a missing depth update, the update id %d > final update id %d + 1", u.FirstUpdateID, finalUpdateID)
} }