add flag for subtrie workers
This commit is contained in:
parent
d1be30346e
commit
44c60ac9e3
@ -44,6 +44,8 @@ type Config struct {
|
|||||||
BackfillCheckPastBlocks uint64
|
BackfillCheckPastBlocks uint64
|
||||||
// Size of the worker pool
|
// Size of the worker pool
|
||||||
NumWorkers uint
|
NumWorkers uint
|
||||||
|
// Number of subtries to iterate in parallel
|
||||||
|
SubtrieWorkers uint
|
||||||
// Should the statediff service wait until geth has synced to the head of the blockchain?
|
// Should the statediff service wait until geth has synced to the head of the blockchain?
|
||||||
WaitForSync bool
|
WaitForSync bool
|
||||||
// Context used during DB initialization
|
// Context used during DB initialization
|
||||||
|
@ -46,7 +46,11 @@ func init() {
|
|||||||
)
|
)
|
||||||
Flags.UintVar(&config.NumWorkers,
|
Flags.UintVar(&config.NumWorkers,
|
||||||
"statediff.workers", 1,
|
"statediff.workers", 1,
|
||||||
"Number of concurrent workers to use during statediff processing (default 1)",
|
"Number of concurrent workers to dispatch to during statediff processing",
|
||||||
|
)
|
||||||
|
Flags.UintVar(&config.SubtrieWorkers,
|
||||||
|
"statediff.subtries", 1,
|
||||||
|
"Number of subtries to iterate in parallel",
|
||||||
)
|
)
|
||||||
Flags.BoolVar(&config.WaitForSync,
|
Flags.BoolVar(&config.WaitForSync,
|
||||||
"statediff.waitforsync", false,
|
"statediff.waitforsync", false,
|
||||||
|
@ -166,10 +166,12 @@ func NewService(cfg Config, blockChain BlockChain, backend plugeth.Backend, inde
|
|||||||
workers = 1
|
workers = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
builder := NewBuilder(blockChain.StateCache())
|
||||||
|
builder.SetSubtrieWorkers(cfg.SubtrieWorkers)
|
||||||
quitCh := make(chan bool)
|
quitCh := make(chan bool)
|
||||||
sds := &Service{
|
sds := &Service{
|
||||||
BlockChain: blockChain,
|
BlockChain: blockChain,
|
||||||
Builder: NewBuilder(blockChain.StateCache()),
|
Builder: builder,
|
||||||
QuitChan: quitCh,
|
QuitChan: quitCh,
|
||||||
Subscriptions: make(map[common.Hash]map[SubID]Subscription),
|
Subscriptions: make(map[common.Hash]map[SubID]Subscription),
|
||||||
SubscriptionTypes: make(map[common.Hash]Params),
|
SubscriptionTypes: make(map[common.Hash]Params),
|
||||||
|
Loading…
Reference in New Issue
Block a user