init jobs maps
This commit is contained in:
parent
3679a9aa17
commit
b51c467084
@ -221,6 +221,8 @@ func New(stack *node.Node, ethServ *eth.Ethereum, cfg *ethconfig.Config, params
|
|||||||
enableWriteLoop: params.EnableWriteLoop,
|
enableWriteLoop: params.EnableWriteLoop,
|
||||||
numWorkers: workers,
|
numWorkers: workers,
|
||||||
maxRetry: defaultRetryLimit,
|
maxRetry: defaultRetryLimit,
|
||||||
|
jobStatusSubs: map[rpc.ID]statusSubscription{},
|
||||||
|
currentJobs: map[uint64]JobID{},
|
||||||
}
|
}
|
||||||
stack.RegisterLifecycle(sds)
|
stack.RegisterLifecycle(sds)
|
||||||
stack.RegisterAPIs(sds.APIs())
|
stack.RegisterAPIs(sds.APIs())
|
||||||
@ -843,9 +845,6 @@ func (sds *Service) writeStateDiffWithRetry(block *types.Block, parentRoot commo
|
|||||||
func (sds *Service) SubscribeWriteStatus(id rpc.ID, sub chan<- JobStatus, quitChan chan<- bool) {
|
func (sds *Service) SubscribeWriteStatus(id rpc.ID, sub chan<- JobStatus, quitChan chan<- bool) {
|
||||||
log.Info("Subscribing to job status updates", "subscription id", id)
|
log.Info("Subscribing to job status updates", "subscription id", id)
|
||||||
sds.Lock()
|
sds.Lock()
|
||||||
if sds.jobStatusSubs == nil {
|
|
||||||
sds.jobStatusSubs = map[rpc.ID]statusSubscription{}
|
|
||||||
}
|
|
||||||
sds.jobStatusSubs[id] = statusSubscription{
|
sds.jobStatusSubs[id] = statusSubscription{
|
||||||
statusChan: sub,
|
statusChan: sub,
|
||||||
quitChan: quitChan,
|
quitChan: quitChan,
|
||||||
|
Loading…
Reference in New Issue
Block a user