diff --git a/actpool/actpool.go b/actpool/actpool.go index c524d86c74..0a3b33d6a9 100644 --- a/actpool/actpool.go +++ b/actpool/actpool.go @@ -141,7 +141,7 @@ func NewActPool(g genesis.Genesis, sf protocol.StateReader, cfg Config, opts ... ap.timerFactory = timerFactory for i := 0; i < _numWorker; i++ { - ap.jobQueue[i] = make(chan workerJob, ap.cfg.MaxNumActsPerAcct) + ap.jobQueue[i] = make(chan workerJob, ap.cfg.WorkerBufferSize) ap.worker[i] = newQueueWorker(ap, ap.jobQueue[i]) if err := ap.worker[i].Start(); err != nil { return nil, err diff --git a/actpool/config.go b/actpool/config.go index 4ee79675ef..453f8d3efc 100644 --- a/actpool/config.go +++ b/actpool/config.go @@ -14,6 +14,7 @@ var ( MaxNumActsPerPool: 32000, MaxGasLimitPerPool: 320000000, MaxNumActsPerAcct: 2000, + WorkerBufferSize: 2000, ActionExpiry: 10 * time.Minute, MinGasPriceStr: big.NewInt(unit.Qev).String(), BlackList: []string{}, @@ -28,6 +29,8 @@ type Config struct { MaxGasLimitPerPool uint64 `yaml:"maxGasLimitPerPool"` // MaxNumActsPerAcct indicates maximum number of actions an account queue can hold MaxNumActsPerAcct uint64 `yaml:"maxNumActsPerAcct"` + // WorkerBufferSize indicates the buffer size for each worker's job queue + WorkerBufferSize uint64 `yaml:"bufferPerAcct"` // ActionExpiry defines how long an action will be kept in action pool. ActionExpiry time.Duration `yaml:"actionExpiry"` // MinGasPriceStr defines the minimal gas price the delegate will accept for an action