mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 06:36:43 +00:00
Buffer size as variable
This commit is contained in:
parent
46deb7322e
commit
3e10bd67ba
1 changed files with 5 additions and 3 deletions
|
|
@ -200,6 +200,7 @@ type Firehose struct {
|
||||||
flushStarted bool
|
flushStarted bool
|
||||||
flushStartBlockNum uint64
|
flushStartBlockNum uint64
|
||||||
flushStartCond *sync.Cond
|
flushStartCond *sync.Cond
|
||||||
|
flushBufferSize int
|
||||||
}
|
}
|
||||||
|
|
||||||
const FirehoseProtocolVersion = "3.0"
|
const FirehoseProtocolVersion = "3.0"
|
||||||
|
|
@ -254,7 +255,8 @@ func NewFirehose(config *FirehoseConfig) *Firehose {
|
||||||
deferredCallState: NewDeferredCallState(),
|
deferredCallState: NewDeferredCallState(),
|
||||||
latestCallEnterSuicided: false,
|
latestCallEnterSuicided: false,
|
||||||
|
|
||||||
flushStartCond: sync.NewCond(&sync.Mutex{}),
|
flushStartCond: sync.NewCond(&sync.Mutex{}),
|
||||||
|
flushBufferSize: 100, // TODO: Optimal buffer size tbd
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.private != nil {
|
if config.private != nil {
|
||||||
|
|
@ -268,8 +270,8 @@ func NewFirehose(config *FirehoseConfig) *Firehose {
|
||||||
log.Info("Firehose concurrent block flushing enabled, starting", config.ConcurrentBlockFlushing,
|
log.Info("Firehose concurrent block flushing enabled, starting", config.ConcurrentBlockFlushing,
|
||||||
"block print worker goroutine")
|
"block print worker goroutine")
|
||||||
|
|
||||||
firehose.flushJobQueue = make(chan *blockPrintJob, 100) // TODO: Optimal buffer size tbd
|
firehose.flushJobQueue = make(chan *blockPrintJob, firehose.flushBufferSize)
|
||||||
firehose.flushOrderedOutputQueue = make(chan *blockOutput, 100)
|
firehose.flushOrderedOutputQueue = make(chan *blockOutput, firehose.flushBufferSize)
|
||||||
for i := 0; i < config.ConcurrentBlockFlushing; i++ {
|
for i := 0; i < config.ConcurrentBlockFlushing; i++ {
|
||||||
firehose.flushJobWG.Add(1)
|
firehose.flushJobWG.Add(1)
|
||||||
go firehose.blockPrintWorker()
|
go firehose.blockPrintWorker()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue