init jobs maps

This commit is contained in:
Roy Crihfield 2023-04-03 22:43:14 +08:00
parent 3679a9aa17
commit b51c467084

View File

@ -221,6 +221,8 @@ func New(stack *node.Node, ethServ *eth.Ethereum, cfg *ethconfig.Config, params
enableWriteLoop: params.EnableWriteLoop,
numWorkers: workers,
maxRetry: defaultRetryLimit,
jobStatusSubs: map[rpc.ID]statusSubscription{},
currentJobs: map[uint64]JobID{},
}
stack.RegisterLifecycle(sds)
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) {
log.Info("Subscribing to job status updates", "subscription id", id)
sds.Lock()
if sds.jobStatusSubs == nil {
sds.jobStatusSubs = map[rpc.ID]statusSubscription{}
}
sds.jobStatusSubs[id] = statusSubscription{
statusChan: sub,
quitChan: quitChan,