mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-21 22:43:52 +00:00
depth: add SetUpdateTimeout
This commit is contained in:
parent
0c7710c91b
commit
b3b1161ecc
|
@ -5,9 +5,10 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/c9s/bbgo/pkg/types"
|
||||
"github.com/c9s/bbgo/pkg/util"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
type SnapshotFetcher func() (snapshot types.SliceOrderBook, finalUpdateID int64, err error)
|
||||
|
@ -35,6 +36,10 @@ type Buffer struct {
|
|||
mu sync.Mutex
|
||||
once util.Reonce
|
||||
|
||||
// updateTimeout the timeout duration when not receiving update messages
|
||||
updateTimeout time.Duration
|
||||
|
||||
// bufferingPeriod is used to buffer the update message before we get the full depth
|
||||
bufferingPeriod time.Duration
|
||||
}
|
||||
|
||||
|
@ -45,6 +50,10 @@ func NewBuffer(fetcher SnapshotFetcher) *Buffer {
|
|||
}
|
||||
}
|
||||
|
||||
func (b *Buffer) SetUpdateTimeout(d time.Duration) {
|
||||
b.updateTimeout = d
|
||||
}
|
||||
|
||||
func (b *Buffer) SetBufferingPeriod(d time.Duration) {
|
||||
b.bufferingPeriod = d
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user