types: reset order book when stream disconnected

This commit is contained in:
c9s 2024-11-20 13:40:09 +08:00
parent 505decce48
commit 5b23671b44
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -212,6 +212,10 @@ func (sb *StreamOrderBook) updateMetrics(t time.Time) {
}
func (sb *StreamOrderBook) BindStream(stream Stream) {
stream.OnDisconnect(func() {
sb.Reset()
})
stream.OnBookSnapshot(func(book SliceOrderBook) {
if sb.MutexOrderBook.Symbol != book.Symbol {
return