@@ -48,7 +48,7 @@ func init() {
4848 DepsFunc : func (cDeps dependencies ) { deps = cDeps },
4949 Configure : configure ,
5050 Params : params ,
51- IsEnabled : func (c * dig.Container ) bool {
51+ IsEnabled : func (_ * dig.Container ) bool {
5252 return restapi .ParamsRestAPI .Enabled && ParamsDebugAPI .Enabled
5353 },
5454 }
@@ -90,11 +90,13 @@ func configure() error {
9090
9191 routeGroup := deps .RestRouteManager .AddRoute ("debug/v2" )
9292
93+ debugAPIWorkerPool := workerpool .NewGroup ("DebugAPI" ).CreatePool ("DebugAPI" , workerpool .WithWorkerCount (1 ))
94+
9395 deps .Protocol .Events .Engine .BlockDAG .BlockAttached .Hook (func (block * blocks.Block ) {
9496 blocksPerSlot .Set (block .ID ().Slot (), append (lo .Return1 (blocksPerSlot .GetOrCreate (block .ID ().Slot (), func () []* blocks.Block {
9597 return make ([]* blocks.Block , 0 )
9698 })), block ))
97- })
99+ }, event . WithWorkerPool ( debugAPIWorkerPool ) )
98100
99101 deps .Protocol .Events .Engine .SlotGadget .SlotFinalized .Hook (func (index iotago.SlotIndex ) {
100102 epoch := deps .Protocol .APIForSlot (index ).TimeProvider ().EpochFromSlot (index )
@@ -113,23 +115,24 @@ func configure() error {
113115 }
114116 }
115117
116- }, event .WithWorkerPool (workerpool . NewGroup ( "DebugAPI" ). CreatePool ( "PruneDebugAPI" , workerpool . WithWorkerCount ( 1 )) ))
118+ }, event .WithWorkerPool (debugAPIWorkerPool ))
117119
118120 deps .Protocol .Events .Engine .Notarization .SlotCommitted .Hook (func (scd * notarization.SlotCommittedDetails ) {
119121 if err := storeTransactionsPerSlot (scd ); err != nil {
120122 Component .LogWarnf (">> DebugAPI Error: %s\n " , err )
121123 }
122- })
124+ }, event . WithWorkerPool ( debugAPIWorkerPool ) )
123125
124- deps .Protocol .Events .Engine .EvictionState . SlotEvicted .Hook (func (index iotago.SlotIndex ) {
126+ deps .Protocol .Events .Engine .Evict .Hook (func (index iotago.SlotIndex ) {
125127 blocksInSlot , exists := blocksPerSlot .Get (index )
126128 if ! exists {
127129 return
128130 }
129131
130132 for _ , block := range blocksInSlot {
131133 if block .ProtocolBlock () == nil {
132- Component .LogInfof ("block is a root block" , block .ID ())
134+ Component .LogInfof ("block is a root block %s" , block .ID ())
135+
133136 continue
134137 }
135138
@@ -146,7 +149,7 @@ func configure() error {
146149 }
147150
148151 blocksPerSlot .Delete (index )
149- })
152+ }, event . WithWorkerPool ( debugAPIWorkerPool ) )
150153
151154 routeGroup .GET (RouteBlockMetadata , func (c echo.Context ) error {
152155 blockID , err := httpserver .ParseBlockIDParam (c , api .ParameterBlockID )
0 commit comments