mirror of
https://github.com/c9s/bbgo.git
synced 2024-09-20 16:21:09 +00:00
fix depth reset
This commit is contained in:
parent
07ded04a9b
commit
06e982124b
|
@ -154,20 +154,20 @@ func (f *DepthFrame) loadDepthSnapshot() error {
|
|||
}
|
||||
|
||||
func (f *DepthFrame) PushEvent(e DepthEvent) {
|
||||
select {
|
||||
case <-f.resetC:
|
||||
f.reset()
|
||||
default:
|
||||
}
|
||||
|
||||
f.snapshotMutex.Lock()
|
||||
snapshot := f.snapshotDepth
|
||||
f.snapshotMutex.Unlock()
|
||||
|
||||
// before the snapshot is loaded, we need to buffer the events until we loaded the snapshot.
|
||||
if snapshot == nil {
|
||||
|
||||
select {
|
||||
case <-f.resetC:
|
||||
f.reset()
|
||||
default:
|
||||
// buffer the events until we loaded the snapshot
|
||||
f.bufferEvent(e)
|
||||
}
|
||||
// buffer the events until we loaded the snapshot
|
||||
f.bufferEvent(e)
|
||||
|
||||
go f.once.Do(func() {
|
||||
if err := f.loadDepthSnapshot(); err != nil {
|
||||
|
|
Loading…
Reference in New Issue
Block a user