Concurrent statediff iteration #12
@ -44,6 +44,8 @@ type Config struct {
|
||||
BackfillCheckPastBlocks uint64
|
||||
// Size of the worker pool
|
||||
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?
|
||||
WaitForSync bool
|
||||
// Context used during DB initialization
|
||||
|
@ -46,7 +46,11 @@ func init() {
|
||||
)
|
||||
Flags.UintVar(&config.NumWorkers,
|
||||
"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,
|
||||
"statediff.waitforsync", false,
|
||||
|
@ -166,10 +166,12 @@ func NewService(cfg Config, blockChain BlockChain, backend plugeth.Backend, inde
|
||||
workers = 1
|
||||
}
|
||||
|
||||
builder := NewBuilder(blockChain.StateCache())
|
||||
builder.SetSubtrieWorkers(cfg.SubtrieWorkers)
|
||||
quitCh := make(chan bool)
|
||||
sds := &Service{
|
||||
BlockChain: blockChain,
|
||||
Builder: NewBuilder(blockChain.StateCache()),
|
||||
Builder: builder,
|
||||
QuitChan: quitCh,
|
||||
Subscriptions: make(map[common.Hash]map[SubID]Subscription),
|
||||
SubscriptionTypes: make(map[common.Hash]Params),
|
||||
|
Loading…
Reference in New Issue
Block a user